I have created progress dialog like this
public VolleyService(Context context, VolleyServiceCompletedListener listener){
this.context = context;
pDialog = new ProgressDialog(context);
pDialog.setMessage("Loading...");
pDialog.setCancelable(false);
this.listener = listener;
}
and tried to show progress dialog using this method.
private void showProgressDialog() {
boolean isShowing = pDialog.isShowing();
if (!isShowing)
pDialog.show();
}
And hide the dialog using this method.
private void hideProgressDialog() {
if (pDialog.isShowing()) {
pDialog.hide();
}
}
The problem is pDialog.isShowing()
returns true even after I have called the pDialog.hide()
. When I see the hide()
method from android.app.Dialog.java
they didn't assign the mShowing
variable as false, but when I call show()
they assigned the mShowing
variable as true.
So is there any reason behind they didn't make as false? And how can I open the same progress dialog again?
don't use hide() use dismiss() instead. This will also prevent leaked window error
refer to this link for more info
Please try to dismiss your dialog.
pDialog.dismiss()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With