开发者

Aggregated View on Contacts with ContactsContract-API

I'm a little bit stuck with the new ContactsContract-API here. I think I don't fully understand the API and hope someone can give me a hint.

I red in the documentation that Android is aggregating several RawContacts to so called "aggregated contacts". Thats a pretty nice new feature with the 2.x Androidrelease.

What I'm not able to do is, to access this "aggregated contact". For example a user has a normal phonecontact with realname and phone saved in his phonebook and he has the same person as facebookcontact with his nickname and his birthday. Now he joins those two contacts and has his nice aggregated contact with the realname, phone and birthday which he can access.

My question: How can I as a developer access this aggregated contact?

I thought about 开发者_如何学Gogetting all RawContacts associated with one Contact like this:

 Cursor c = getContentResolver().query(RawContacts.CONTENT_URI,
      new String[]{RawContacts._ID},
      RawContacts.CONTACT_ID + "=?",
      new String[]{String.valueOf(contactId)}, null);

But then I would not be able to decide which name is the "real name" of the Contact and other problems. And I disliked my other hackish ideas how to aggregated those RawContacts myself, because Android with the help of the user already did this job.

Any hint how I can query those aggregated Contacts is very much appreciated!


If I understand your question correctly, ContactsContract.RawContactsEntity may help you. Check this


This problem has now been solved in this thread: Get all contacts and their details (e.g. postal address) in one OUTER JOIN query

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜