Is a good practice create anonymous AsyncTask for parallel small known freeze process? [closed]

匆匆过客 提交于 2019-12-03 00:12:13

Yes, but not the way you do it.

Remember that starting Honeycomb the default execution model of AsyncTasks is serial:

  new AsyncTask<Void, Void, Void>() {
         ....
         ....
  }.execute(); <------ serial execution


Instead use a thread pool executor:

  new AsyncTask<Void, Void, Void>() {
         ....
         ....
  }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null); <------ parallel execution
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!