In my application I start an AsyncTask to download some data, and on the UI thread I start a ProgressDialog. The problem is when I change from portrait to landscape or vice versa, on the onPostExecute of the task I cannot dismiss the ProgressDialog. The dismiss() function is called over the instance of the ProgressDialog, but it doesn’t dismiss. Why is that?
Thanks
EDIT :
I think I lose the reference of the current activity in the AsyncTask thread. Is this possible? And if it is, how do I fix it?
EDIT :
Can’t I keep a reference of the asyncTask and put it in the bundle?
Try to use
android:configChangesattribute of your activity to make it not recreating when switching orientation.