How to show a loading bar when rendering with Webview.loadUrl in android?
Try this segment of code. Show a progressDialog or image or layout whatever you want in onPageStarted()
& hide in onPageFinished()
webview.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon)
{
// TODO show you progress image
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url)
{
// TODO hide your progress image
super.onPageFinished(view, url);
}
});
Try this
......
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
activity.setTitle("Loading...");
activity.setProgress(progress * 100);
if(progress == 100)
activity.setTitle(R.string.app_name);
}
});
...