Chapter 13. Exploring Handlers

We showed in Chapter 12 that each package runs in its own process. In this chapter, we will explain the organization of threads within this process. This will lead us to why we need handlers.

Most code in an Android application runs in the context of a component such as an Activity or a Service. We will show how these components of an application interact with threads. Most of the time there is only one thread running in an Android process called the main thread. We will talk about the implications of sharing this main thread among various components. Primarily, this can lead to Application Not Responding (ANR) messages(the "A" stands for "application" and not "Annoying"). We will show you how you can use handlers, ...

Get Pro Android 3 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.