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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access