O'Reilly logo

The Android™ Developer’s Cookbook: Building Applications with the Android SDK, Second Edition by Nelson To, Ronan Schwarz, James Steele, Phil Dutson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Loaders

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required