WebView Show Loading progress

sapan
If you have embedded webview in your app and want to show loading progress until the page is fully loaded use the below code





        //find the webview
        WebView wview = (WebView)findViewById(R.id.webview);
        wview.setWebChromeClient(new WebChromeClient() {
            private ProgressDialog mProgress;

            @Override
            public void onProgressChanged(WebView view, int progress) {
                if (mProgress == null) {
                    mProgress = new ProgressDialog(mContext);
                    mProgress.show();
                }
                mProgress.setMessage("Loading " + String.valueOf(progress) + "%");
                if (progress == 100) {
                    mProgress.dismiss();
                    mProgress = null;
                }
            }
        });
        wview.loadUrl("http://www.androidlearner.com");






Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !