Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
254 views
in Technique[技术] by (71.8m points)

android - How to deal with orientation change with a ProgressDialog showing?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try adding this attribute android:configChanges="orientation" to your Activity element in the AndroidManifest.xml file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...