I'm using code like the following, and on my phone it returns 4000+ rows, but on my phone I have 295 contacts in the Contacts app.
Whats going on here? I've been reading up on the contacts database, and I'm not yet familiar enough to figure this out.
Thanks!
final ContentResolver cr = getContentResolver();
final Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
List<Contact> contacts = new ArrayList<>();
final int nameIdx = cur.getColumnIndex(DISPLAY_NAME);
final int idIdx = cur.getColumnIndex(ContactsContract.Contacts._ID);
while (cur.moveToNext()) {
String name = cur.getString(nameIdx);
String id = cur.getString(idIdx);
contacts.add(new Contact(name, id));
}
cur.close();