I have created a custom account and i have added few contacts to that account. So now i want to remove the account from those contacts. I'm Googling since few weeks but i'm not able to find anything. If anyone knows how to do then please help me out.
Thanks.
The below code solved my problem :)
String selection = ContactsContract.RawContacts._ID+ "=?";
String selectionargs[] = { String.valueOf(rawContactId) }; //Get rawContactId
int deletedRawContacts = context.getContentResolver().delete(ContactsContract.RawContacts.CONTENT_URI.buildUpon()
.appendQueryParameter(ContactsContract.RawContacts.ACCOUNT_NAME, ACCOUNT_NAME)
.appendQueryParameter(ContactsContract.RawContacts.ACCOUNT_TYPE, ACCOUNT_TYPE)
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build(),
selection,selectionargs);
System.out.println("No. of contacts deleted are " + deletedRawContacts);