Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:IllegalStateException:无法从游标窗口读取第24929行第0列_Android_Sqlite_Illegalstateexception - Fatal编程技术网

Android:IllegalStateException:无法从游标窗口读取第24929行第0列

Android:IllegalStateException:无法从游标窗口读取第24929行第0列,android,sqlite,illegalstateexception,Android,Sqlite,Illegalstateexception,我需要有关此错误的帮助: 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 re

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

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行时,我会得到这个异常。 这是安卓系统的限制吗

你能帮我吗?
谢谢

试试这个-如果有的话!=null{int id;而res.moveToNext{id=res.getIntres.getColumnIndexid;//表中理论最大行数为18446744073709551616或约1.8e+19您的表可能没有id列?
 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;
}