I\'m trying to update a contact of my phone book directly from my app. I\'m able to add and delete the contacts but the update just does nothing!
After the insert or
For Updating contact you need to have both contactId and RawContact id... so while updating add this also as a value in where clause/selection args..
something like this..
ArrayList ops = new ArrayList();
//------------------------------------------------------ Names
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValue(ContactsContract.Data.RAW_CONTACT_ID, rawContactId)
.withValue(ContactsContract.Data.MIMETYPE,
ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredName.PREFIX, data.getTitle())
.withValue(ContactsContract.CommonDataKinds.StructuredName.SUFFIX, data.getSuffix())
.withValue(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, data.getFirstName())
.withValue(ContactsContract.CommonDataKinds.StructuredName.MIDDLE_NAME, data.getMiddleName())
.withValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME, data.getSuffix())
.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, data.getFirstName()+" "+data.getMiddleName()).build());