在数据库中实现记录的更新sqlite给了我这个错误,我留下了。 我将不胜感激。 我查看了关闭连接并打开但未更改错误。 SDK是motodevstudio 3和“Android 2.2。”
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): FATAL EXCEPTION: main
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): java.lang.RuntimeException: Unable to resume activity {com.ftair/com.ftair.Infraccion}: java.lang.IllegalStateException: database /data/data/com.ftair/databases/daastm already closed
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3128)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2059)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.os.Handler.dispatchMessage(Handler.java:99)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.os.Looper.loop(Looper.java:123)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at java.lang.reflect.Method.invokeNative(Native Method)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at java.lang.reflect.Method.invoke(Method.java:521)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at dalvik.system.NativeStart.main(Native Method)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): Caused by: java.lang.IllegalStateException: database /data/data/com.ftair/databases/daastm.jpg already closed
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:237)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.database.sqlite.SQLiteQuery.requery(SQLiteQuery.java:145)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.database.sqlite.SQLiteCursor.requery(SQLiteCursor.java:531)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.Activity.performRestart(Activity.java:3795)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.ActivityThread.performRestartActivity(ActivityThread.java:3477)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:160)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.LocalActivityManager.dispatchResume(LocalActivityManager.java:518)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.ActivityGroup.onResume(ActivityGroup.java:58)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.Activity.performResume(Activity.java:3823)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
11-30 09:40:34.052: ERROR/AndroidRuntime(2646): ... 10 more
答案 0 :(得分:0)
在尝试创建/读取/更新/删除之前直接打开数据库,并在完成后关闭它。这应该可以阻止错误。即使此活动打开数据库,也可能从onStart
到onStop
说活动堆栈上的另一个活动正在关闭数据库。