DatabaseConnector Method updateContact

Method updateContact (Fig. 8.54) is similar to method insertContact, except that it calls SQLiteDatabase’s update method (line 76) to update an existing contact. The update method’s third argument represents a SQL WHERE clause (without the keyword WHERE) that specifies which record(s) to update. In this case, we use the record’s row ID to update a specific contact.

62   // updates an existing contact in the database63   public void updateContact(long id, String name, String phone,64      String email, String street, String city, String state, String zip)65   {66      ContentValues editContact = new ContentValues();67      editContact.put("name", name);68      editContact.put( ...

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.