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

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


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