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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.