android 4.0 以上平台选择图片报错Attempted to access a cursor after it has been closed.
16lz
2021-01-23
android 4.0 以上平台选择图片报错Attempted to access a cursor after it has been closed.
android.database.StaleDataException: Attempted to access a cursor after it has been closed.at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2444)at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2472)at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1173)at android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:137)at android.app.ActivityThread.main(ActivityThread.java:4424)at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java:511)at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)at dalvik.system.NativeStart.main(Native Method)Caused by: android.database.StaleDataException: Attempted to access a cursor after it has been closed.
4.0以上平台会自动关闭cursor
//4.0以上的版本会自动关闭 (4.0--14;; 4.0.3--15) if(Integer.parseInt(Build.VERSION.SDK) < 14) { cursor.close(); }
更多相关文章
- Android 系统信息获取(CPU,RAM,ROM,Battery,SD-card,版本等)
- Notification用法,注意API版本,API大于11的setLatestEventInfo()方
- Android 平台上玩DOS游戏
- 《Android 获取当前app的版本号和版本名称》
- Android P 以及之后版本不支持同时从多个进程使用具有相同数据目
- 拥抱Android:编译nodejs搭建移动平台
- Android Sqlite数据库跨版本升级 保存之前数据
- 探索 Android 平台的 CameraX
- Android多平台推送