Component and Process Lifetimes

As you have seen so far, as messages get dropped on the queue, the main thread comes around to process those messages. What would happen to the messages that are pending in the main queue if you were to hit the Back button or the Home button? What would happen to the worker thread that is executing? We will explain what happens by considering the life cycle of each of the Android components.

Although we discuss the component life cycles here, please note that this is not a full discussion of those life cycles. The activity life cycle is already described with the help of a diagram in Chapter 2. Similarly, the service life cycle is elaborated on in Chapter 15. The discussion here is limited to addressing only those ...

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

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