January 2014
Intermediate to advanced
736 pages
70h 43m
English
When a Fragment is attached to an Activity as we did in Chapter 5 and will do in this chapter, its lifecycle is tied to that of its parent Activity. There are six Activity lifecycle methods that have corresponding Fragment lifecycle methods—onCreate, onStart, on-Resume, onPause, onStop and onDestroy. When the system calls these methods on an Activity, it will also call these corresponding methods (and potentially other Fragment lifecycle methods) on all of the Activity’s attached Fragments.
This app uses Fragment lifecycle methods onPause and onDestroy. An Activity’s onPause method is called when another Activity receives the focus, which pauses the one that loses the focus and sends it to the background. ...
Read now
Unlock full access