I am still trying to find the \"correct\" design pattern when dealing with AsyncTask
s and screen rotation. I read this commonsware blog post which links to thi
There's nothing inherently wrong with using a deprecated method. If your AsyncTask is THAT critical that you can't cancel it and start it up again if your orientation changes, you should consider using a service.
It's only deprecated on Honeycomb and above, and it will work just fine on those too. The 'new' way is to use loaders (you can use the compatibility library to get those in pre-HC versions) or retained fragments. If you call setRetainInstance()
the instance passed as is to the newly created activity (they actually use onRetainNonConfigurationInstance
in the FragmentActivity
of the compatibility library), so it's effectively the same as what you have now.