4. Advanced Threading Techniques
This chapter showcases a collection of threading techniques that are provided by the Android Framework to make the usage of threads easier and more secure. First, the Loaders API that comes with the support package is demonstrated. Next, the AsyncTask API is shown, which is a very flexible and powerful replacement for raw Java threads. Then the ways of using inter-process communication on Android are discussed.
Typical usage scenarios for threads are the moments in an application lifecycle when screens are initialized with data from databases or caches. If done on the main thread, these operations can block the loading of the layout itself and leave the user staring at a blank screen for a couple of seconds. ...