0

I am just stuck at a little thing for about 1 full day I created a webview android app and its working fine but i want a progress dialogue box which basically appears when the next page loads. here is my code

//ProgressDialogue
    ProgressDialog pd = null;

    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        pd=new ProgressDialog(MainActivity.this);
        pd.setTitle("Please Wait..");
        pd.setMessage("Your Internet is Slow..");
        pd.show();
        super.onPageStarted(view, url, favicon);
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        pd.dismiss();
        super.onPageFinished(view, url);
    }

Please help me fix this and tell me the error and i did imported android.app.ProgressDialog;

1 Answers1

0
  ProgressDialog pd; //Global
  pd=new ProgressDialog(MainActivity.this); // OnCreate
        pd.setTitle("Please Wait..");
        pd.setMessage("Your Internet is Slow..");


    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        super.onPageStarted(view, url, favicon);  // Should be First
        pd.show();
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url); //Should be First 
        pd.dismiss();
    }
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198