Lee Jarvis wrote: > The code works fine, except when I try and change screen orientation, > the progress dialog doesn't disappear and the task seems to be > executed again, I realize this is because the onCreate() method is > being called again on orientation change perhaps?
Yes. By default, on an orientation change, activities are destroyed and recreated. > What would be the best solution for this issue? I don't know about "best". Some options include: 1. A static flag or something that indicates whether your background task is running, so you only fire off the task in onCreate() if that flag is false. 2. Overriding the default orientation-handling code, so your activity is not destroyed and recreated: http://www.androidguys.com/2008/11/11/rotational-forces-part-three/ 3. Finding some other way of handling your background work that does not require it to be invoked every time the activity starts up, if that's possible. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 1.0 In Print! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en