0

Using the Android 2.0 ContactsContract API, is it possible to build a list of objects representing contacts in a Contact Group like this:

public class GroupContact {  
    public String displayName;
    public List<String> phoneNumbers;
}

While making fewer than O(n) SQL queries?

ekad
  • 14,436
  • 26
  • 44
  • 46
timschwer
  • 1
  • 1
  • Check out this ;) http://stackoverflow.com/questions/5422942/how-do-you-get-the-members-of-a-contact-group – Inoy Feb 14 '13 at 22:22

1 Answers1

0

Maybe, it depends on a couple of things.

I presume by n you mean the number of phone numbers for the display name.

By queries I suspect you really mean cursor.moveToNext() calls.

In any case what you are looking for can be done with one query having n-1 moveTo*() calls. The query makes use of the "view_data" view.

On the content provider side you want...

SELECT * FROM "view_data" WHERE "display_name" = 'mo howard';

or from the ContentResolver

phreed
  • 1,759
  • 1
  • 15
  • 30