Wednesday, 4 September 2013

ContactContracts getContentResolver().delete and update not functioning correctly

ContactContracts getContentResolver().delete and update not functioning
correctly

Hi I have defined the update and delete as below but the result is keep
duplicating the number in the textView of the name. Is there some
operations missing or doing wrong in the below code?
else if(requestCode == DELETE_REQUEST_CODE) {
getContentResolver().delete(ContactsContract.Data.CONTENT_URI,ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME+"=?",
new String[]{name});
}
else if(requestCode == UPDATE_REQUEST_CODE) {
ContentValues cv = new ContentValues();
cv.put(ContactsContract.CommonDataKinds.Phone.NUMBER,number);
getContentResolver().update(ContactsContract.Data.CONTENT_URI, cv,
ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME+"=?", new
String[]{name});
}

No comments:

Post a Comment