Delete a contact

Quickly share your Android Code Snippets here...

Delete a contact

Postby rcpinheiro » Tue May 25, 2010 5:58 pm

Hi!
It seems incredible but I didn't found anywhere code on how to delete a contact using the new 2.x method.
According to the official docs this should work but it doesn't (returns 0):

getContentResolver().delete(ContactsContract.Contacts.CONTENT_URI,
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME+"="+name_to_delete, null);

Anyone knows how to do this simple task? Thanks in advance!
rcpinheiro
Junior Developer
Junior Developer
 
Posts: 13
Joined: Fri Apr 02, 2010 6:45 pm

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 5 guests