有没有办法将对象分配给联系人,android
我知道如何从 android 的本机联系人列表中检索、编辑或删除联系人。我对每个联系人都有特定的任务。我希望当我单击联系人时我想知道分配给该对象的任务是什么。有没有办法将任何对象分配给任何联系人。就像我们为按钮或 ImageView 所做的 setTag() 和 get Tag() 一样。 我没有找到任何方法将对象分配给联系人。
谢谢
I know how to retrieve, edit, or delet a contact from native contact list in android. I have certain task for each contact. I want when i click on the contact I want to know what is the task assigned to the object. Is there any way to assign any object to any contact. like we do setTag() and get Tag() for buttons or ImageView.
I didnt find any way to assign the object to the contact.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法将普通对象分配给联系人,但可以设置自定义数据字段。这是通过创建新的 Mime 类型来完成的。查看此答案以了解具体信息:如何在 android 2.0 的联系人中添加自定义数据/字段?
创建自定义 Mime 类型后,您可以添加和检索与此类型关联的任何数据您的联系人。
You can't assign a plain object to a Contact but you can set custom data fields. This is done by creating a new Mime Type. Check out this answer for the specifics: How to add custom data/field in contacts in android 2.0?
Once you've created you're custom Mime Type, you can add and retrieve data associated with this type for any of your contacts.
您可以将任何数据存储在自己的数据库中,并使用查找键作为联系人数据库的外键。
And you can store any data in own database and use the LOOKUP KEY as foreign key to contacts database.