January 2014
Intermediate to advanced
736 pages
70h 43m
English
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( ...
Read now
Unlock full access