Game Development Reference
In-Depth Information
4.
Press the home button (which will take you back to the home screen).
5.
On the home screen, on older Android versions (prior to version 3),
hold the home button until you are presented with the currently running
applications. On Android versions 3+, touch the Running Apps button.
Select the Android Basics Starter app to resume (which will bring the test
activity back onscreen).
6.
Press the back button (which will take you back to the starter activity).
If your system didn't decide to kill the activity silently at any point when it was paused, you will
see the output in Figure 4-4 (of course, only if you haven't pressed the back button yet).
Figure 4-4. Running the LifeCycleTest activity
On startup, onCreate() is called, followed by onResume() . When we lock the screen, onPause()
is called. When we unlock the screen, onResume() is called. When we press the home button,
onPause() is called. Going back to the activity will call onResume() again. The same messages are,
of course, shown in LogCat, which you can observe in Eclipse in the LogCat view. Figure 4-5
shows what we wrote to LogCat while executing the preceding sequence of actions (plus
pressing the back button).
Search WWH ::




Custom Search