0

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!

rogcg
  • 10,451
  • 20
  • 91
  • 133

2 Answers2

0

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.

Octavian Helm
  • 39,405
  • 19
  • 98
  • 102
0

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

phreed
  • 1,759
  • 1
  • 15
  • 30
  • as octavian mentioned for whatever meaning is intended the android version is very important. – phreed Dec 15 '10 at 14:42