Still adjusting to the changes in Android 4.0 regarding AsyncTask. 

If I understand right, the default behavior of execute is changing to one 
single thread pool with only one thread? With the reason cited that 
programmers are not capable of handling a bigger threadpool (I'm 
paraphrasing). 

Does that mean, that absent some code changes, all asynctasks inside a 
process will only happen sequentially?  

So therefore, if I have a service running DownloadDictionaryTask in the 
background, and the user chooses a menu item that starts 
CheckDiskSpaceTask, the progress bar will cycle without any progress 
because the task never makes progress?

A user and I could briefly reproduce a situation where, as far as I could 
tell, no asynctasks were running, yet my AsyncTask would not even start. In 
this case, I couldn't even get one thread. Alas, I cannot reproduce that 
situation, which appeared to fix itself without any code changes. 

But in any case, this isn't really acceptable to have only one asynctask 
task run at once. But there is no central way to control that behavior, is 
there? I would have to replace 83 instances of task.execute with 
task.executeonExecutor. Since the above method is only available in SDK>11, 
this isn't a one line change - it's more like 10-20 lines of code with 
reflection, and some extensive testing. 

In my opinion, this a deplorable punishment for those developers who have 
dutifully followed the AsyncTask pattern, which, to this day, the Android 
platform has encouraged. 

Or perhaps I am reading this wrong. Maybe all DownloadDictionaryTasks share 
one pool, and all CheckDiskSpaceTasks share another pool. In that case, the 
rule is that only one task *of the same concrete type* can run at once. 
This rule, I can probably live with, as I've used my own threading pools 
for tasks that are truly data parallel.  

Can anyone enlighten me more?

Nathan

-- 
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