Skip to content

Instantly share code, notes, and snippets.

@mahdimortazavi
Created December 20, 2016 16:20
Show Gist options
  • Save mahdimortazavi/f6d9e0ea10922bd524a5c7040378b53d to your computer and use it in GitHub Desktop.
Save mahdimortazavi/f6d9e0ea10922bd524a5c7040378b53d to your computer and use it in GitHub Desktop.
ProgressDialog webView
final ProgressDialog pd = ProgressDialog.show(this, "", "Loading...", true);
WebView webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://www.google.com");
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
if (pd != null && pd.isShowing()) {
pd.dismiss();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment