Illegalstateexception Asynctask - Onpostexecute
I published my app. it is working smoothly on my device. But I get some crash reports on play console. But I couldn't figure out how to handle it. I know the problem is progress di
Solution 1:
Your AsyncTask has no access to ui elements. Call this line from a runnable or try this.fpd.dismiss();
.
The AsyncTask is not running in the apps main thread, which is the reason why you can not access them.
Solution 2:
The problem is that you are dismissing a dialog in the onPostExecute. The underlying activity could already be gone. You have to check if the activity is still there. That's why you get an IllegalStateException. The state of the activity was saved when it disappeared and you wanted to dismiss the dialog afterwards, this won't work.
Post a Comment for "Illegalstateexception Asynctask - Onpostexecute"