It's pretty clear from all the activity around this issue in this
forum in multiple threads over the past several months  that there's a
painful design flaw regarding AsyncTasks and screen rotation. The
basic issue that people want to address is how to handle the onDestroy
when an AsyncTask is running.
A lot of games can be played with static inner classes, attach/detach,
onRetainNonConfigurationInstance, and so on but it all becomes
dauntingly complex when you get beyond the most bare-bones test case.
This is especially true when the UI needs some results from the
AsyncTask, the most common case. Essentially, you end up doing as much
work as if you were using an IntentService.

I think the Big G should change the documentation around AsyncTask to
make it clear that using it from a UI thread is a recipe for
complexity and therefore not recommended. Of course, providing a
_simple_ way to decouple long-running activities from the UI thread
was exactly what AsyncTask was design to do. But let's admit that it
didn't work out that way. The docs should point people at
IntentService, perhaps adding some wrappers around that class to make
it simpler to use when you just need to decouple a long-running task
from the UI.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to