大家好,我在准备联系人列表时遇到以下异常。
04-13 13:51:15.210: E/AndroidRuntime(7343): java.lang.IllegalStateException: get field slot from row 0 col -1 failed
这是我的 getContact 函数
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;
}
在下一行引发异常。
String number = people.getString(numberFieldColumnIndex);
有什么问题?