コード例 #1
0
  //    updateContact
  public int updateContact(Contact contact) {
    SQLiteDatabase db = this.getWritableDatabase();

    ContentValues values = new ContentValues();
    values.put(KEY_ID, contact.getID());
    values.put(KEY_NAME, contact.getName());
    values.put(KEY_PH_NO, contact.getPhoneNumber());

    return db.update(
        TABLE_CONTACTS, values, KEY_ID + "=?", new String[] {String.valueOf(contact.getID())});
  }
コード例 #2
0
 //    deleteContact
 public void deleteContact(Contact contact) {
   SQLiteDatabase db = this.getWritableDatabase();
   db.delete(TABLE_CONTACTS, KEY_ID + "=?", new String[] {String.valueOf(contact.getID())});
   db.close();
 }