How run two AsyncTasks in one Activity?
If you want to run multiple AsyncTasks
in parallel, you can call executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
instead of execute()
on your task. By default, AsyncTasks
run in serial, first come first serve.
Be careful that the two threads do not interact on the same data, this can cause some strange and hard to trace errors.