android java.lang.IllegalStateException: trying to requery an already closed cursor
16lz
2021-01-23
错误提示:
Java.lang.RuntimeException: Unable to resume activity {com.lenovo.leos.memowidget/com.lenovo.leos.notepad.NoteEditor}: java.lang.IllegalStateException: trying to requery an already closed cursor
可能错误的使用方法:
query(android.net.Uri, String[], String, String[], String)
startManagingCursor(Cursor)
由activity在通过query获取了Cursor之后用startManagingCursor来管理Cursor的生命周期的,那么每一次调用完毕之后Cursor也会相应的被关闭;由此从history menu tab进入的时候则可能因为Cursor被关闭了而导致异常。
解决办法:
不使用startManagingCursor(Cursor)来管理Cursor的生命周期,自己使用.close()管理。
更多相关文章
- Android触控屏幕Gesture(GestureDetector和SimpleOnGestureListe
- Android之TabHost的几种使用方法
- Android-Intent的使用方法详解
- android Application的生命周期
- android运行后台服务de生命周期yu使用技巧
- 再看Android 屏幕切换引起的生命周期变化
- Android pm命令使用方法
- android投屏和媒体共享相关 && audio focus机制相关 && AudioTra