First of all, sorry for by bad English. I have android 2.3, so there is "Real" parallel AsyncTask instead of sequentially execution (android 3.0 and higher). I have several AsyncTasks, each of them executes onPostExecute() callback (I know that it will be executed in UI thread). Suppose I have only 2 parallel AsyncTask, and when first task has finished its job, callback onPostExecute() will be called. Is it possible, that while onPostExecute() (from first AsyncTask) method is running on UI thread, second task is calling its onPostExecute() method interrupting current execution of first AsyncTask's onPostExecute() ?
// UPDATED I explain it with code now:
// AsyncTask1
onPostExecute(Result result) {
activity->processResult1(result);
}
// AsyncTask2
onPostExecute(Result result) {
activity->processResult2(result);
Suppose AsyncTask1 has finished its job and that processResult1() is very long running method: While we executing processResult1() on UI thread, AsyncTask2 finish its job. What happens now?
- processResult1() will be interrupted by processResult2()
- processResult2() waits till processResult1() ends