Homework 4: Activity Spy
Due April 12
Having done several programming assignments, it is now time to start developing an official Android app that isn't just plain "Hello, World."
Your task is to build an application that recognizes how to write out to the Android diagnostic log for each Activity lifecycle method.
Having a good understanding of the Activity Lifecycle will ensure you know when and where certain executions of your methods should take place. You will become more aware of how the internal logic of Android works, which ultimately helps you put your methods at the right place so that they will be executed in the right manner.
Always refer to the Assignment section for any changes to the assignment.
Understanding Log
Log
You'll need to be comfortable writing log messages to the console. You can learn more about log from a section of this guide and from the official documentation website.
Understanding Activity Lifecycle
Make sure you have a sense of how each event, namely onCreate
, onStop
, and particularly onDestroy
, is triggered.
The assignment asks that the onDestroy
event is triggered and that this event is produced in the log file.
You can learn more about activity lifecycle from a previous section in the guide and from the official docs.
Debugging LogCat
LogCat
You can use the following two commands
Commands
Description
adb logcat
Runs logcat
adb logcat -f file
Writes the content of the log to a file
Last updated