Android中的SqLite。一切正常,但突然出现错误

时间:2016-11-19 10:30:36

标签: java android sqlite android-sqlite

java.lang.IllegalStateException:无法从CursorWindow读取第30行第9行。在从中访问数据之前,请确保Cursor已正确初始化。

这是我的代码。

Cursor cursor = dataBase.query("MyBooks", null, null, null, null, null, "COLUMN_LAST_OPEN");
cursor.moveToFirst();
if (!cursor.isAfterLast()) {
    do {
        path = cursor.getString(9); //exception arises here

    } while (cursor.moveToNext());
}

光标位置122出现异常,但异常表示该行为30.如果我通过调用cursor.moveToPrevious将代码更改为从头开始迭代,那么它正在工作。

1 个答案:

答案 0 :(得分:0)

现在我发现android中的Cursor不能容纳超过1 Mb的数据。这是异常的原因。