Created Thursday 11 July 2013
- The AsyncTask class encapsulates the creation of a background process and the synchronization with the main thread. It also supports reporting progress of the running tasks.
- Android executes AsyncTask tasks in parallel by default before Android 1.6
- Android executes AsyncTask tasks in sequence by default as of Android 3.0.
- You can tell Android to run it in parallel with the usage of the executeOnExecutor() method, specifying AsyncTask.THREAD_POOL_EXECUTOR as first parameter.
Big Disadvantage of AsyncTask
- The AsyncTask does not handle configuration changes automatically, i.e. if the activity is recreated, the programmer has to handle that in his coding.
A common solution to this is to declare the AsyncTask in a retained headless fragment.
No backlinks to this page. comments powered by Disqus