MainActivity Method onContactDeleted
Method onContactDeleted (Fig. 8.21) from the DetailsFragment.DetailsFragmentListener interface is called by the DetailsFragment to notify the MainActivity when the user deletes a contact. In this case, line 122 pops the DetailsFragment from the back stack. If the app is running on a tablet, line 125 calls the contactListFragment’s updateContactList method to reload the contacts.
118 // return to contact list when displayed contact deleted119 @Override120 public void onContactDeleted()121 {122 getFragmentManager().popBackStack(); // removes top of back stack123 124 if (findViewById(R.id.fragmentContainer) == null) // tablet125 contactListFragment.updateContactList(); ...
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