Hi guys i’m getting the following Exception while readying contact list.
04-13 13:51:15.210: E/AndroidRuntime(7343): java.lang.IllegalStateException: get field slot from row 0 col -1 failed
Here is my getContact function
public static ContactList getContactList(Context context){
ContactList contactList = new ContactList(RequestStatus.CONTACT_LIST);
Cursor people = context.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);
contactList.addContact(new Contact(contact,number));
}
people.close();
return contactList;
}
The exception is being thrown at following line.
String number = people.getString(numberFieldColumnIndex);
what could be wrong?
You can use the below method to get a list of contacts::