Hello everyone. I am trying to get contact information from the contacts database using ContentResolver with this field to get the name, number, FORMATTED_ADDRESS, PHOTO details for the contact in one request.
So basically I need to make 3 contact requests in order to get these Details.
What I want to know is whether there is a simpler and more effective way to achieve this.
but using the code below, I get an exception.
java.lang.IllegalArgumentException: Invalid column data1
Can any body help me find a solution for the same.
Uri uri = ContactsContract.Contacts.CONTENT_URI; String[] projection = new String[] { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS, ContactsContract.CommonDataKinds.Photo.PHOTO}; String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + " = '1'"; String[] selectionArgs = null; String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; Cursor contacts = getContentResolver().query(uri, projection, selection, selectionArgs, sortOrder);
source share