I can't use a progress dialog in a Fragment
. I tried using a progress dialog in an Activity
, however, and it worked.
Here's part of my code:
private class MyCustomWebViewClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
final ProgressDialog pd = ProgressDialog.show(this, "", "Loading...",
true);
pd.setCancelable(false);
pd.setTitle("Please wait");
pd.setMessage("Page is loading..");
pd.show();
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
The error is:
The method show(Context, CharSequence, CharSequence, boolean) in the type ProgressDialog is not applicable for the arguments (CommunityFragment.MyCustomWebViewClient, String, String, boolean)
How can I fix this?