Android: Couldn't init Cursor Window

时光怂恿深爱的人放手 提交于 2019-12-11 08:36:14

问题


I'm getting the following error and stack traces:

Caused by: java.lang.IllegalStateException: Couldn't init cursor window
at android.database.CursorWindow.native_init(Native Method)
at android.database.CursorWindow.<init>(CursorWindow.java:41)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:276)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:268)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:171)
at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:248)

Does anyone know why? I can't reproduce the error on my devices (works fine for me).


回答1:


i think you should :

if (!cursor.isClosed() ||cursor != null)
             {
                     cursor.close();
                     cursor=null;
             }

and all you open cursor should close,and put close at the last



来源:https://stackoverflow.com/questions/9862696/android-couldnt-init-cursor-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!