Skip to content Skip to sidebar Skip to footer

Progress Dialog Could Not Stop

I am new to android.I am using progress dialog in my app but it could not stop.In my app i am using webview.In first activity I have connect button.In second activity connect to fa

Solution 1:

Try like this

First create dialog in your onCreate()

ProgressDialogprogressDialog=newProgressDialog(getApplicationContext());
progressDialog.setMessage("Please Wait");

Then show the dialog in onPageStarted() method.

progressDialog .show();

Then dismiss it in your onPageFinished() method

progressDialog.cancel();

Solution 2:

You should not create Dialog in onPageStart, when loading a web page, onPageStart() could be called multi times.

In you onPageStart, you create a new Dialog without closing the old one, so the old dialog will always show.

To solve this you have many choices:

  1. As lmran said, create the dialog only once in onCreate(). Show it in onPageStarted and dismiss in onPageFinished.
  2. Before create a new Dialog, dismiss the old one.

Solution 3:

just this code used and try it out,

@OverridepublicvoidonPageFinished(WebView view, String url) {
            Log.e("status","calling....");
            super.onPageFinished(view, url);
            if (prDialog != null || prDialog.isShowing())
                prDialog.dismiss();
            Log.e("status","calling next......");
        }

Solution 4:

    @Override
        publicvoid onPageFinished(WebView view, String url) {

            try{
                    if (prDialog.isShowing()|| prDialog!= null) {
                        prDialog.dismiss();
                        prDialog= null; /*** Add ***/
                    }

                    }catch(Exceptionexception){
                        exception.printStackTrace();
                    }

            }
        }

You may also visit the following link to get a complete detail...

http://androiddubd.blogspot.com/2014/07/how-to-show-progress-dialog-or-loader.html

Post a Comment for "Progress Dialog Could Not Stop"