AddEditFragment Method saveContact
The saveContact
method (Fig. 8.40) saves the information in this Fragment
’s EditText
s. 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 String
s from the EditText
s 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 String
s from the EditText
s 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 ...
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.