Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete contact in android?

I want to delete user name whose name is Leo. So I am putting delete query as follow

    int i = getContentResolver().delete(Contacts.CONTENT_URI, Contacts.DISPLAY_NAME +"= 'Leo'",null);
    System.out.println("rows deleted "+i);
but it returns "rows deleted 0"

what is wrong with it.

Edits : The above is not working because the field is read only using Contacts.CONTENT_URI You can see using following URI. http://developer.android.com/reference/android/provider/ContactsContract.Contacts.html

like image 464
Vivek Avatar asked Dec 05 '25 16:12

Vivek


1 Answers

http://developer.android.com/resources/samples/SampleSyncAdapter/index.html

In above link I can able to find the solution. I can able to delete contacts completely.

The problem is related to sync adapter.

like image 95
Vivek Avatar answered Dec 08 '25 07:12

Vivek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!