如何删除Android的联系? [英] How to delete contact in android?

查看:146
本文介绍了如何删除Android的联系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要删除他的名字是狮子座的用户名。所以,我把删除查询如下

  INT I = getContentResolver()删除(Contacts.CONTENT_URI,Contacts.DISPLAY_NAME +=狮子座,NULL);
    的System.out.println(删除行+ I);


 但它返回行删除0


什么是错的吧。

编辑:
上述不工作,因为该字段为只读使用 Contacts.CONTENT_URI
您可以看到使用以下URI。
http://developer.android.com/reference/android/provider/ContactsContract.Contacts.html


解决方案

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

在上面的链接,我可以能够找到解决方案。我可以能够彻底删除联系人。

问题与同步适配器。

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

解决方案

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.

这篇关于如何删除Android的联系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆