Code example for ProgressBar

Methods: setMaxsetVisibility

0
        //webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); 
        // Set a dummy WebViewClient (which enables loading a new page in own WebView). 
        mWebView.setWebViewClient(new WebViewClient(){});
        // Add a progress bar. 
        mProgress = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
        layout.addView(mProgress, new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, 5));
        mProgress.setMax(100);
        mProgress.setVisibility(View.GONE);
        mWebView.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                if (progress < 100) {
                    mProgress.setVisibility(View.VISIBLE);
                    mProgress.setProgress(progress);
                } else { 
                    mProgress.setVisibility(View.GONE);
                } 
            } 
        }); 
        // Create a JavaScript interface and bind the WebView to it. 
        mJSInterface = new JSInterface();
        mWebView.addJavascriptInterface(mJSInterface, "UnityInterface");