I have one existing contact, I need to add a work address to that existing contact. I am using the following code, but it\'s not working.
String selectPhone
//Sorry for my bad english
// It seems that in the first post you forgot to add the MimeType in operation.
String selectPhone = Data.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "='" +
ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE + "'" ;
String[] phoneArgs = new String[]{String.valueOf(rawContactId)};
ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI)
.withSelection(selectPhone, phoneArgs)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET, STREET)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY, CITY)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.REGION, REGION)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE, POSTCODE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY, POSTCODE)
**
//Just add this line
.withValue(Data.MIMETYPE, "vnd.android.cursor.item/postal-address_v2")
**
.build());
this.context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
Please check this and let me know the result