9.9 MainActivity
Class
Class MainActivity
manages the app’s fragments and coordinates the interactions between them. On phones, MainActivity
displays one Fragment
at a time, starting with the ContactsFragment
. On tablets, MainActivity
always displays the ContactsFragment
at the left of the layout and, depending on the context, displays either the DetailFragment
or the AddEditFragment
in the right two-thirds of the layout.
9.9.1 Superclass, Implemented Interfaces and Fields
Class MainActivity
(Fig. 9.24) uses class FragmentTransaction
from the v4
support library to add and remove the app’s Fragment
s. MainActivity
implements three interfaces:
Get Android How to Program, 3/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.