January 2014
Intermediate to advanced
736 pages
70h 43m
English
Method displayAddEditFragment (Fig. 8.20) receives a View’s resource ID specifying where to attach the AddEditFragment and a Bundle of key–value pairs. If the second argument is null, a new contact is being added; otherwise, the Bundle contains the data to display in the AddEditFragment for editing. Line 105 creates the AddEditFragment. If the Bundle argument is not null, line 108 uses it to set the Fragment’s arguments. Lines 111–115 then create the FragmentTransaction, replace the contents of the View with the specified resource ID, add the Fragment to the back stack and commit the transaction.
Read now
Unlock full access