December 2013
Beginner
416 pages
12h 45m
English
Now let’s look at how the Android activity lifecycle works. In Chapter 3, you overrode the onCreate method. Now you’ll override the remaining lifecycle methods in your TimerActivity class by following these steps.
1. Open the TimerActivity.java file in the project, and override the existing onStart method, which is called when the activity is first viewed. Call the onStart method of the parent class, and log a debug message:
@Overridepublic void onStart(){ super. onStart(); Log.d(CLASS_NAME, "onStart");}
2. Override the existing onPause method, which is called when another activity is called to the foreground. Call the onPause method of the parent and log a debug message: ...
Read now
Unlock full access