0

I want to have all of the contact's fields but i don't know which class of Contacts Contract do that.

By this code i receive email address:

Cursor email = getContentResolver().query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, null, null, null);

This code is used for each field but i need all fields at once, for example:

Phone - Email - Group Member ship - Identity - Nickname - Organization and etc.

How can i get all of these records at once?

Elham Gdz
  • 1,015
  • 3
  • 15
  • 31

1 Answers1

0

Additionally, you can loop through your contacts and simply get the name and phone number like this:

Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);

while(people.moveToNext()) {
   int nameFieldColumnIndex = people.getColumnIndex(PhoneLookup.DISPLAY_NAME);
   String contact = people.getString(nameFieldColumnIndex);
   int numberFieldColumnIndex = people.getColumnIndex(PhoneLookup.NUMBER);
   String number = people.getString(numberFieldColumnIndex);
}

people.close();
Kanaiya Katarmal
  • 5,974
  • 4
  • 30
  • 56