Android AsyncTask - Order of execution

前端 未结 6 1258
醉酒成梦
醉酒成梦 2020-12-30 07:58

I am facing an issue regarding the order of exection of AsyncTasks.

My question is :

Assuming I have 2 implementations of AsyncTask : MyAsyncTask1

6条回答
  •  清歌不尽
    2020-12-30 08:43

    Don't make things complicated and try to keep your design simple and clean. The race between your both AsyncTasks depends on the amount of processing they carry inside their overrided methods. Logically, if you want your AsyncTask1 to complete before AsyncTask2, then simply add the code-blocks of your second Async inside the first one.

    Or launch your second Async from the onPostExecute of your first Async - but personally, that seems unnecessary.

提交回复
热议问题