-4

In the Android application from the Application-class will start a few singletons, each with a few AsyncTask's. In this case, it will simultaneously run a maximum of 5 or 128 AsyncTask's? SDK>16

Arvalon
  • 101
  • 6

2 Answers2

0

How many async task can be used in a class android? check this thread, I think it would be useful. Summary - you can run as much as you want, but they would execute parallel or serial after some point (when all threads would be used). And it depends on device.

Community
  • 1
  • 1
A. Shevchuk
  • 2,109
  • 14
  • 23
0

When first introduced, AsyncTasks were executed serially on a single background thread. Starting with DONUT, this was changed to a pool of threads allowing multiple tasks to operate in parallel. Starting with HONEYCOMB, tasks are executed on a single thread to avoid common application errors caused by parallel execution.

Based on the description above, I assumed that starting from API 11, all tasks will be executed in serial execution on a single thread, meaning that one at a time, unless we call AsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); on every tasks we execute, but still the number of tasks can be run at a time is still depends on resources at that time, e.g. number of cores are free to processing.

CodePlay
  • 1,914
  • 14
  • 20