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
Two causes for your error happen:
The error will happen if you're trying to show a
Dialog
after you've exited anActivity
.Also, if an unhandled Exception was thrown in your
AsyncTask
, which would cause theActivity
to shutdown, then an open progress dialog will cause theException
.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 yourActivity
to stop and leaking yourDialog
.You must check which one of them is finishing your
Activity
before you show theDialog
. A good solution is to dismiss theDialog
(if it's showing) before callingfinish()
.Check the condition for dialog, before showing.
Like this
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.