2

我在 SimpleCursor 适配器和加载器管理器(支持 v4)的帮助下填充了一个网格视图。网格视图的内容是在分页的帮助下从 Web 服务器获取的。如果我在 web 服务调用期间在详细视图和网格视图之间快速切换视图,我会收到非法状态错误 /StaleDataException。

05-15 00:36:54.114: E/AndroidRuntime(10656): java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteQuery: SELECT * FROM product_list WHERE (url =  ? )
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:58)
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:151)
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.database.sqlite.SQLiteCursor.onMove(SQLiteCursor.java:124)
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:213)
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.database.CursorWrapper.moveToPosition(CursorWrapper.java:162)
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.support.v4.widget.CursorAdapter.getView(CursorAdapter.java:247)
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.widget.AbsListView.obtainView(AbsListView.java:2452)
05-15 00:36:54.114: E/AndroidRuntime(10656):    at android.widget.GridView.makeAndAddView(GridView.java:1331

)

4

1 回答 1

0

也许您忘记在 resetLoader 回调中添加 adapter.swapcursor(null) ?我遇到了相同的日志,而这却丢失了,并且多次打开 + 关闭了 listfragment ..

于 2015-01-09T12:00:54.177 回答