You can check out how I handle AsyncTask
s and orientation changes at code.google.com/p/shelves. There are various ways to do it, the one I chose in this app is to cancel any currently running task, save its state and start a new one with the saved state when the new Activity
is created. It’s easy to do, it works well and as a bonus it takes care of stopping your tasks when the user leaves the app.
You can also use onRetainNonConfigurationInstance()
to pass your AsyncTask
to the new Activity
(be careful about not leaking the previous Activity
this way though.)