3
嘿我在我的代码中获取索引超出界限的错误。游标索引超出界限错误Android?
从活动:
Cursor cursor = mDbHelper.fetchA(b);
@SuppressWarnings("static-access")
int a = (int) cursor.getDouble(cursor.getColumnIndex(mDbHelper.KEY_I));
cursor.close();
我的DB适配器:
public Cursor fetchA(String b){
return mDb.query(DATABASE_TABLE, new String[] {KEY_I}, "b=\""+B+"\"", null, null, null, null);
}
错误:
E/AndroidRuntime(5766): FATAL EXCEPTION: main
E/AndroidRuntime(5766): android.database.CursorIndexOutOfBoundsException: Index
-1 requested, with a size of 1
我该如何解决这个问题?