Wait for multiple AsyncTask to complete

前端 未结 5 1031
自闭症患者
自闭症患者 2020-12-15 21:16

I am parallelizing my operation by splitting it in the exact number of cores available and then, by start the same number of AsyncTask, performing the same operation but on

5条回答
  •  星月不相逢
    2020-12-15 21:58

    Another Option could be to store all your new threads in an Array.

    Then you could iterate over the Array and wait with thread[i].join for the thread to finish.

    see join() http://developer.android.com/reference/java/lang/Thread.html#Thread(java.lang.Runnable)

    When the Iteration is finished all your threads are done and you can work on

提交回复
热议问题