Question

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 exactly 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!

Was it helpful?

Solution

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.

OTHER TIPS

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top