Alex Rivera | Logout

How to deal with orientation change with a ProgressDialog showing?

Asked 2010-09-12T15:54:04.657
17

I am showing a ProgressDialog in the onPreExecute method of an AsyncTask object and canceling the ProgressDialog in the onPostExecute method. In the doInBackground method I am making an HTTP request for user registration. I wish to allow screen orientation changes. When I change the orientation while the doInBackground method is still running, i get all sorts of fun errors like 'IllegalArgumentException: View not attached to window manager' and 'RegisterScreen has leaked window...'

How can I properly continue to show the ProgressDialog after an orientation change? Or maybe, how can I disable orientation change after the user requests to submit their registration?

Edit
Report

1 Answer

2

Add this in activity tag in application manifest.xml

<activity android:label="@string/app_name" android:configChanges="keyboardHidden|orientation|screenSize" android:name=".your.package"/>

answered 2013-06-14T11:37:04.727

Your Answer