java.lang.IllegalStateException: attempt to re-open an already-closed object On Orientation Change

▼魔方 西西 提交于 2019-12-02 07:53:35

When using a CursorLoader with the Loader framework, you should not close() the Cursor yourself. The CursorLoader will handle it.

Though the docs for CursorLoader don't specifically mention this, the general docs for Loaders note it under Using the LoaderManager Callbacks, in the onLoadFinished section.

The loader will release the data once it knows the application is no longer using it. For example, if the data is a cursor from a CursorLoader, you should not call close() on it yourself. If the cursor is being placed in a CursorAdapter, you should use the swapCursor() method so that the old Cursor is not closed.

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