So we declare a SimpleCursorAdapter as follows
SimpleCursorAdapter adapter = new SimpleCursorAdapter(
this,
R.layout.contactsview,
c,
projection,
new int[] {R.id.contactEntryText}
);
I used the projections as follows
String [] projection = new String [] {
ContactsContract.Contacts.DISPLAY_NAME
};
I got the exception Java.lang.IllegalArgumentException: column '_id' does not exist.
Make sure that the projection you have mentioned above do contain a field called as ContactsContract.Contacts._ID.
So you have to redeclare the array projection as
String [] projection = new String [] {ContactsContract.Contacts.DISPLAY_NAME,ContactsContract.Contacts._ID
};
Thats it. Now you are good to go !!!!!!!!
No comments:
Post a Comment