I have to agree with Nathan, I've never read anywhere that AsyncTasks should only be used for "short lived" tasks (a couple seconds). The official documenation says "This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers." Not only is it bad grammer :), it can easily be interpreted as ok to use for most background tasks (not everyone can get direct advice from a framework engineer). On top of that, why would AsyncTasks offer "onProgressUpdate" if they are only used for tasks that take a couple seconds? That would indicate it's made for "long running" tasks.
Again, a lot of this is over my head, but maybe it helps to see the point of view from an "average" developer. -Kris http://www.filtrsoft.com Custom news monitoring apps On Saturday, April 21, 2012 6:58:58 PM UTC-4, Romain Guy (Google) wrote: > > > The sole role of AsyncTask was to help not block the UI > > > thread, not offer a fully fledged threading framework since, as you > > mentioned, the core APIs provide solid foundations for that. The > > advice I regularly give developers is to use the executor framework > > directly if they want more control over their tasks. > > And to answer your question, AsyncTask was already using the executor > framework in 1.5. Speaking of 1.5, AsyncTask was using a serialized > behavior in that release. This behavior is explained in the current > documentation of the execute() method: > > "Note: this function schedules the task on a queue for a single > background thread or pool of threads depending on the platform > version. When first introduced, AsyncTasks were executed serially on a > single background thread. Starting with DONUT, this was changed to a > pool of threads allowing multiple tasks to operate in parallel. After > HONEYCOMB, it is planned to change this back to a single thread to > avoid common application errors caused by parallel execution. If you > truly want parallel execution, you can use the > executeOnExecutor(Executor, Params...) version of this method with > THREAD_POOL_EXECUTOR; however, see commentary there for warnings on > its use." > > -- > Romain Guy > Android framework engineer > romain...@android.com > > -- 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