AddEditFragment Method saveContact

The saveContact method (Fig. 8.40) saves the information in this Fragment’s EditTexts. First, lines 162–163 create the DatabaseConnector object, then we check whether the contactInfoBundle is null. If so, this is a new contact and lines 168–175 get the Strings from the EditTexts and pass them to the DatabaseConnector object’s insertContact method to create the new contact. If the Bundle is not null, an existing contact is being updated. In this case, we get the Strings from the EditTexts and pass them to the DatabaseConnector object’s updateContact method, using the existing rowID to indicate which record to update. DatabaseConnector methods insertContact and updateContact each handle opening and closing the database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset