> I know the Android team is just trying to provide a > helper functionality, but to change the default behavior like this is > yet another API sin; IMHO
FWIW the parallel/serialized behavior was not initially documented, on purpose. 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