I am having one java class in that class as soon some one purchases our application then it will start downloading and progress dialog has to appear instead it goes to some other page and when i come out of the application and when i restart then it starts downloading.
Please Help me out from this mess...
Thank you
Check the condition for dialog, before showing.
Like this
if(pDialog!=null)
{
if(!pDialog.isShowing())
{
pDialog.show();
}
}
and also while removing the dialog in onPostexecute()
check for null.
if Still not works just remove the pDialog
and try once with your code.
Two causes for your error happen:
The error will happen if you're trying to show a Dialog
after you've exited an Activity
.
Also, if an unhandled Exception was thrown in your AsyncTask
, which would cause the Activity
to shutdown, then an open progress dialog will cause the Exception
.
According to the Log you've posted, the error happens after you call pDialog.show()
which might be the 1st cause I've mentioned before.
Also you are calling finish()
in many parts of your code, maybe one of these calls are making your Activity
to stop and leaking your Dialog
.
You must check which one of them is finishing your Activity
before you show the Dialog
. A good solution is to dismiss the Dialog
(if it's showing) before calling finish()
.