Previously I selected everything by putting a null, but i get an error complaining that it has too many rows, so I'm trying to get a projection of the display name, contact id and phone number but getting the following error: "column '_id' does not exist"
Here's the code:
final String[] projection = { ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER,ContactsContract.CommonDataKinds.Phone.CONTACT_ID };
Cursor cur = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection,
"LENGTH(" + ContactsContract.CommonDataKinds.Phone.NUMBER
+ ") >= 8 ) GROUP BY ("
+ ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, null,
sortOrder);
But the error points to this line in my customadapter
super(context, layout, c, from, to);
Need help! Thanks!
Add BaseColumns._ID
to your projection array.