问题描述
android.database.CursorWindowAllocationException: Cursor window allocation of 512000 kb Failed. # Open Cursors=1 (# cursors opened by this proc=1)
at android.database.CursorWindow.<init>(CursorWindow.java:108)
at android.database.AbstractwindowedCursor.clearOrCreateWindow(AbstractwindowedCursor.java:198)
at android.database.sqlite.sqliteCursor.fillWindow(sqliteCursor.java:140)
at android.database.sqlite.sqliteCursor.getCount(sqliteCursor.java:134)
at com.material.components.database.tables.Tbl_BookList.getBookList(Tbl_BookList.java:110)
at com.material.components.fragment.FragmentHome$1.onResponse(FragmentHome.java:64)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:71)
读取 getMybookList() 函数时会发生此问题.. 代码是
public List<BookList> getMyBookList() {
sqliteDatabase db = DbHelper.getInstance().getReadableDatabase();
Cursor cursor = db.rawQuery("select * from " + TABLE_BOOK_LIST+ " where " + COL_BOOK_LIST_read + " = 1",null);
List<BookList> callPriorityList = new ArrayList<>(cursor.getCount());
cursor.movetoFirst();
for (int i = 0; i < cursor.getCount(); cursor.movetoNext(),i++) {
BookList bookList = new BookList();
bookList.setId(cursor.getInt(cursor.getColumnIndex(COL_BOOK_LIST_id)));
bookList.setBook_title(cursor.getString(cursor.getColumnIndex(COL_BOOK_LIST_title)));
bookList.setBook_auther(cursor.getString(cursor.getColumnIndex(COL_BOOK_LIST_author)));
bookList.setCover_image(cursor.getString(cursor.getColumnIndex(COL_BOOK_LIST_cover)));
bookList.setBanner_image(cursor.getString(cursor.getColumnIndex(COL_BOOK_LIST_banner)));
bookList.setBook_description(cursor.getString(cursor.getColumnIndex(COL_BOOK_LIST_discription)));
callPriorityList.add(bookList);
}
cursor.close();
return callPriorityList;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)