MainActivity Method onAddContact

Method onAddContact (Fig. 8.19) from the ContactListFragment.ContactListFragmentListener interface is called by the ContactListFragment to notify the MainActivity when the user chooses to add a new contact. If the layout contains the fragmentContainer, line 97 calls displayAddEditFragment (Fig. 8.20) to display the AddEditFragment in the fragmentContainer; otherwise, line 99 calls displayAddEditFragment to display the Fragment in the rightPaneContainer. The second argument is a Bundle. Specifying null indicates that a new contact is being added.

92      // display the AddEditFragment to add a new contact93      @Override94      public void onAddContact()95      {96         if (findViewById( ...

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.