草庐IT

CursorIndexOutOfBoundsException

全部标签

android.database.CursorIndexOutOfBoundsException : Index -1 requested, 大小为 2

下面是我的代码,我得到了android.database.CursorIndexOutOfBoundsException:Index-1requested,withasizeof2错误。谁能告诉我怎么解决?ContentResolvercr=getContentResolver();Cursorcur=cr.query(ContactsContract.Contacts.CONTENT_URI,null,null,null,null);if(Integer.parseInt(cur.getString(cur.getColumnIndex(People.PRIMARY_PHONE_ID

android.database.CursorIndexOutOfBoundsException : Index 0 requested, 大小为 0

我正在使用自定义适配器扩展光标适配器来在ListView中显示数据,以显示特定的电话号码,我已将id传递给数据库类中的一个方法,但它正在显示errorandroid.database.CursorIndexOutOfBoundsException:Index0requested,withasizeof0在将调试器放在方法中时,它不会在行之后num=cursor.getString(cursor.getColumnIndex("ContactNumber"));谁能帮我解决。这是代码:publicStringgetNumberFromId(intid){Stringnum;db=this
12