安卓:管理与查找键接触 [英] Android: Manage contacts with lookup key
问题描述
我目前正在写一个应用程序,允许保存草稿(使用Android版本> = 2.0)。每个草案连接到通过 ContactsContract.Contacts.LOOKUP_KEY
联系人。
我的问题是,如果我改变我的联系人的姓名查找键的变化也。是,这种工作方式?
I'm currently writing a application that allows to save drafts (using android version >= 2.0). Each draft is connected to a contact via the ContactsContract.Contacts.LOOKUP_KEY
.
My problem is that if I change the name of my contact the lookup key changes also. Is that the way this works?
因此,对于什么才是我需要一个查找键?我认为查找键也永远不会改变,现在它改变反正。我感到困惑的行为...
So for what do I need a lookup key? I thought that the lookup key does never change and now it changes anyway. I'm confused about that behavior ...
有人能向我解释如何永久链接到联系人?我应该使用的ID,而不是查找键的?
Can someone explain to me how to link permanently to a contact? Should I use IDs instead of the lookup key?
在此先感谢。
推荐答案
这是我的理解是,查找关键是结构化/层次化的关键。因此,严格来说,它可以改变,但还是被用来寻找你的背部接触,使用适当的方法:
It is my understanding that the lookup key is a structured / hierarchical key. Hence strictly speaking it can change, but still be used to find your contact back, by using the appropriate method:
Uri lookupUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey);
Uri res = ContactsContract.Contacts.lookupContact(getContentResolver(), lookupUri);
这篇关于安卓:管理与查找键接触的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!