Process: com.yuyigufen.ecanal, PID: 8065
java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/com.yuyigufen.ecanal/files/city.db
at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1312)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1255)
at com.qit.citywheelview.wheelview.util.CityDatabaseUtil.getLeaders(CityDatabaseUtil.java:80)
at com.qit.citywheelview.CityWheelDialog$3.onChanged(CityWheelDialog.java:137)
at com.qit.citywheelview.wheelview.WheelView.notifyChangingListeners(WheelView.java:295)
at com.qit.citywheelview.wheelview.WheelView.setCurrentItem(WheelView.java:409)
at com.qit.citywheelview.wheelview.WheelView.doScroll(WheelView.java:796)
at com.qit.citywheelview.wheelview.WheelView.access$100(WheelView.java:48)
at com.qit.citywheelview.wheelview.WheelView$1.onScroll(WheelView.java:167)
at com.qit.citywheelview.wheelview.WheelScroller$2.handleMessage(WheelScroller.java:206)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
使用三级联动的时候,调用本地数据库,当窗口关闭的时候,把连接数据库也关闭了,再打开的时候就导致这个错误。
public void closeDb() {
//关闭数据库连接
sqLiteDatabase.close();
}
解决方法:关闭数据库的操作放进应用程序退出操作中
网友评论