Android 联系人:更新、删除、插入
我对通讯录的基本操作有疑问,看起来官方示例对我不起作用。其中之一:
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
.withValue(Data.RAW_CONTACT_ID, id)
.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
.withValue(Phone.NUMBER, "1-800-GOOG-411")
.withValue(Phone.TYPE, Phone.TYPE_CUSTOM)
.withValue(Phone.LABEL, "free directory assistance")
.build());
这应该添加具有给定 ID 的联系人,但在模拟器中运行此代码后我没有获得任何新联系人。
我将非常感谢任何指导性答案或教程链接。
i have problem with basic operations on the contact book, looks like official examples doesn't work for me. One of them:
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
.withValue(Data.RAW_CONTACT_ID, id)
.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
.withValue(Phone.NUMBER, "1-800-GOOG-411")
.withValue(Phone.TYPE, Phone.TYPE_CUSTOM)
.withValue(Phone.LABEL, "free directory assistance")
.build());
This should add a contact with the given id, but I don't get any new contacts after running this code in emulator.
I will really appreciate any guiding answer or link to the tutorials.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该拥有以下权限:
您应该拥有代码(在您的代码之后):
这将尝试插入/更新联系人
you should have the following permissions:
you should have the code (after your code):
this will try to insert / update the contact
只需为您的应用程序实现此代码并尝试删除特定联系人列表,
Just this code implement for your apps and try out for delete particular contacts list,