Second AsyncTask not executing Second AsyncTask not executing multithreading multithreading

Second AsyncTask not executing


I hated it when HONEY COMB changed the multiple AsyncTask execution from concurrent to sequential.So every time I execute an AsyncTask, I do something like this.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);} else {    task.execute();}

But the thread pool size is 5, if you add the sixth task, it will be added in a queue, and will not be executed until one of the 5 thread has finished.


Since I don't know which API level you are using, I would suggest you to go through ASYNC TASK

According to the documentation:

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. Starting with HONEYCOMB, tasks are executed on a single thread to avoid common application errors caused by parallel execution.

If you truly want parallel execution, you can invoke executeOnExecutor(java.util.concurrent.Executor, Object[]) with THREAD_POOL_EXECUTOR.


Have you tried executing transmitter in connector's onPostExecute() or vice versa ?