MainActivity Method onContactSelected

Method onContactSelected (Fig. 8.17) from the ContactListFragment.ContactListFragmentListener interface is called by the ContactListFragment to notify the MainActivity when the user selects a contact to display. If the app is running on a phone (line 65), line 66 calls method displayContact (Fig. 8.18), which replaces the ContactListFragment in the fragmentContainer (defined in Section 8.4.6) with the DetailsFragment that shows the contact’s information. On a tablet, line 69 calls the FragmentManager’s popBackStack method to pop (remove) the top Fragment on the back stack, then line 70 calls displayContact, which replaces the contents of the rightPaneContainer (defined in Section 8.4.6) with the DetailsFragment ...

Get Android™ How to Program, Second Edition 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.