Chapter 3. Fragment Lifecycle and Specialization
This chapter discusses the relationship of the lifecycle of fragments to that of activities, and demonstrates the appropriate programming actions at the various points in the lifecycle. The special purpose fragment classes ListFragment
and DialogFragment
are introduced with coverage of their use and how their behavior in the activity lifecycle differs from that of standard fragments.
The following topics are covered in this chapter:
Fragment setup/display event sequence
Fragment teardown/hide event sequence
Working with the
ListFragment
classWorking with the
DialogFragment
classInteracting with a
DialogFragment
class as a traditionalDialog
classWrapping an existing
Dialog
class in aDialogFragment
class
By the end of this chapter, we will be able to coordinate the setup and teardown of fragments within their host activities, and be able to effectively utilize the ListFragment
and DialogFragment
classes.