Can anyone help me when I add this ProgressDialog
to my Webview
app its work fine but when the page is loaded the progress dialog
is not dismissed can anyone help me I am using this code in Fragment
public static ProgressDialog progressDialog;
mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
swipeRefreshLayout.setRefreshing(true);
progressDialog.show(getActivity(), "Loading...", "Please wait YouTube is Loading...");
super.onPageStarted(view, url, favicon);
}
public void onPageFinished(WebView view, String url) {
swipeRefreshLayout.setRefreshing(false);
getActivity().setTitle(view.getTitle());
if(progressDialog!=null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
super.onPageFinished(view, url);
}
});
Edited code which is working for me now thanks to everyone who help me
public static ProgressDialog progressDialog;
//Under onCreate View
progressDialog = ProgressDialog.show(getActivity(), "Loading...", "Please wait YouTube is Loading...");
mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
swipeRefreshLayout.setRefreshing(true);
super.onPageStarted(view, url, favicon);
}
public void onPageFinished(WebView view, String url) {
swipeRefreshLayout.setRefreshing(false);
getActivity().setTitle(view.getTitle());
if(progressDialog!=null && progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog.hide();
}
super.onPageFinished(view, url);
}
});