Android contacts database giving me an exception
问题 Whenever I try to access the number of a contact I get an index out of bounds exception, can anyone please tell me what I am doing wrong here. Members of the class private String[] names; private String[] number; In my onCreate ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); if (cur.getCount() > 0) { names = new String[cur.getCount()]; number = new String[cur.getCount()]; while (cur.moveToNext()) { String id =