gpt4 book ai didi

Android:IllegalStateException:无法从 CursorWindow 读取第 24929 行,第 0 列

转载 作者:太空狗 更新时间:2023-10-29 15:25:51 25 4
gpt4 key购买 nike

我需要有关此错误的帮助:

Fatal Exception: java.lang.IllegalStateException: Couldn't read row 24929, col 0 from CursorWindow. 
Make sure the Cursor is initialized correctly before accessing data from it

在这段代码中:

SQLiteDatabase db = getReadableDatabase();
Cursor res = db.rawQuery("select id from " + pTable, null);

if (res != null) {
if (res.getCount() != 0) {
res.moveToFirst();
int id;
while (!res.isAfterLast()) {
id = res.getInt(res.getColumnIndex("id")); // <-- Error was here
// ...
res.moveToNext();
}
}
res.close();
}

此代码有时有效,但当我有很多行(如 25k 行)时,我会收到此异常。是 Android 限制吗?

你能帮我吗?谢谢!

最佳答案

 public ArrayList<Model> Name(){
ArrayList<Model> ModelList = new ArrayList<>();
db = getWritableDatabase();
Cursor c = db.rawQuery(" SELECT * FROM " + pTable,null );
while (c.moveToNext()){
String id = c.getString(0);
return ModelList;
}

关于Android:IllegalStateException:无法从 CursorWindow 读取第 24929 行,第 0 列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38573296/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com