开发者

How to get the id of the contact on Android contact list?

开发者 https://www.devze.com 2023-01-30 01:43 出处:网络
Hey, I want to get the id of the contact which is in the list of contacts on Android. I mean, when I add a contact to the phone, I think it has an Id, what is the class that provides this parameter? I

Hey, I want to get the id of the contact which is in the list of contacts on Android. I mean, when I add a contact to the phone, I think it has an Id, what is the class that provides this parameter? I mean the ex开发者_开发技巧actly Id.

I've search if some constants on CallLog.Calls can provide it, but I didn't found. Maybe it's Contacts.Contract, I don't know. Does anyone knows?

Thanks!


Depends on the lowest API level you want to support. If it is API level 5 (2.0 Eclair) and above then ContactsContract.Contacts should be the class you are looking for. If you are developing for API levels below then the Contacts class is your friend.


I may be misunderstanding the question but it sounds like psyhclo is asking about the "_id" column value for newly added contacts. That is a question about the backing store (sqlite). If that is the case then the id is available in several ways (including the uri returned by the insert).

0

精彩评论

暂无评论...
验证码 换一张
取 消