Logging the Activity Lifecycle

In this section, you are going to override lifecycle functions to eavesdrop on MainActivity’s lifecycle. Each implementation will simply log a message informing you that the function has been called. This will help you see how MainActivity’s state changes at runtime in relation to what the user is doing.

Making log messages

In Android, the android.util.Log class sends log messages to a shared system-level log. Log has several functions for logging messages. The one that you will use most often in this book is d(…), which stands for debug. (There are many levels of logging; you can learn more about them in the section called For the More Curious: Log Levels near the end of this chapter.) ...

Get Android Programming: The Big Nerd Ranch Guide, 5th Edition 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.