在Android的SQLite的例外 [英] SQLite Exception in android

查看:166
本文介绍了在Android的SQLite的例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我的应用程序中包含的SQLite。我的应用程序一段时间收到以下错误

hi my application contains SQLite .My application some time getting the following error

java.lang.RuntimeException: Unable to destroy activity {com.fitzsoftware.grocessaryList/com.fitzsoftware.grocessaryList.GrocessaryList}: android.database.sqlite.SQLiteException: unable to close due to unfinalised statements
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3655)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3673)
at android.app.ActivityThread.access$2900(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteException: unable to close due to unfinalised statements
at android.database.sqlite.SQLiteDatabase.dbclose(Native Method)
at android.database.sqlite.SQLiteDatabase.onAllReferencesReleased(SQLiteDatabase.java:320)
at android.database.sqlite.SQLiteDatabase.close(SQLiteDatabase.java:881)
at com.fitzsoftware.grocessaryList.GrocessaryList.onDestroy(GrocessaryList.java:103)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3642)

我将结束使用DataClass.dh.db.close()数据库中的destroy();
为什么这个错误occured.Give我this.Thanks解决方案提前。

I am closing the db in Destroy() using DataClass.dh.db.close(); Why this Error occured.Give me the solutions for this.Thanks in advance.

推荐答案

我迟到了,但我就是看到这个。就我而言,我创造了一个光标对象从数据库中查询,然后不小心关闭数据库之前,我关闭光标。检查这是否是发生了什么。

I'm late to the party, but I just saw this. In my case, I had created a Cursor object from a database query, then accidentally closed the database before I closed the cursor. Check whether this is what's happening.

这篇关于在Android的SQLite的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆