简体   繁体   中英

Error updating record in Android with sqlite

implementing an update of a record in a database sqlite gives me this error that I leave. I would appreciate some help. I have reviewed close connections and open but does not change the error. The SDK is motodevstudio 3 and "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

Open your database directly before you try and create/read/update/delete and close it when you finish with it. This should stop the error. It's possible that even if this activity leaves the database open say from onStart to onStop that another activity on the activity stack is closing the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM