below is my code for delete contact from phone
Uri contactUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,
Uri.encode(phone));
Cursor cur = mContext.getContentResolver().query(contactUri, null,
null, null, null);
boolean flag = false;
try {
if (cur.moveToFirst()) {
do {
if (cur.getString(
cur.getColumnIndex(PhoneLookup.DISPLAY_NAME))
.equalsIgnoreCase(name)) {
String lookupKey = cur
.getString(cur
.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
Uri uri = Uri.withAppendedPath(
ContactsContract.Contacts.CONTENT_LOOKUP_URI,
lookupKey);
mContext.getContentResolver().delete(uri, null, null);
flag=true;
break;
}
} while (cur.moveToNext());
}
} catch (Exception e) {
flag=false;
System.out.println(e.getStackTrace());
}
delete contact from phone is working fine but sim contact delete temporary mean when my phone is restart my contact is recover that i deleted. help in find solution for this problem. Thanks...