Chapter 7 Flashcards
fragment
controller object that an activity can deputize to perform tasks. Most commonly, the task is managing a user interface. The UI can be an entire screen or one part of the screen.
UI fragment
fragment managing a user interface. UI fragments has a view of its own that is inflated from a layout file.
UI fragments separates the UI of your app into building blocks (t/f)
True
cost of UI fragments
more complexity, more moving parts, and more code
support library
includes Fragment class that you can use on any Android device running API level 4 or higher. Allows backwards-compatibility to be relatively painless.
for compatibility with lower API levels, you subclass FragmentActivity instead of just Fragment class. (t/f)
True
To host a UI fragment
Activity must :
define a spot in its layout for the fragments view;
manage the lifecycle of the fragment instance.
difference between fragment lifecycle and activity lifecycle
fragment lifecycle methods are called by the hosting activity, not the OS. OS knows nothing about the fragments that an activity is using to manage things.