How can I retrieve only Android contacts that have an entry in the People app? -


i want include autocomplete textbox in android app adapter being list of user's contacts' display names, started this:

    private static final string[] contact_columns = new string[] { contactscontract.contacts.display_name, basecolumns._id };      list<string> contacts = new arraylist<string>();     contentresolver cr = this.getcontentresolver();     cursor cursor = cr.query(contactscontract.contacts.content_uri, contact_columns, null, null, null);     while (cursor.movetonext()) {         string name = cursor.getstring(0);         contacts.add(name);     }     cursor.close();      arrayadapter<string> adapter = new arrayadapter<string>(this, r.layout.contact_list_item, contacts.toarray(new string[] {}));     multiautocompletetextview txtfriends = (multiautocompletetextview) findviewbyid(r.id.newvisitfriends);     txtfriends.setadapter(adapter);     txtfriends.settokenizer(new multiautocompletetextview.commatokenizer()); 

the result of query, however, returns every single contact every source, including many duplicate names , various email addresses may have sent email user's gmail account @ point.

is there way can retrieve contacts appear in people app?

probably should filter cr.query contacts phone number (contactscolumns.has_phone_number):

http://developer.android.com/reference/android/provider/contactscontract.contactscolumns.html#has_phone_number


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -