문제

I'm ceating an application with SQLite. When I'm fetching the values from the database, I'm getting the error below:

10-30 15:06:07.584: ERROR/Database(817): Leak found
10-30 15:06:07.584: ERROR/Database(817): java.lang.IllegalStateException: /data/data/com.fitzsoftware.grocessaryList/databases/example.db SQLiteDatabase created and never closed
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1581)
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659)
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:482)
10-30 15:06:07.584: ERROR/Database(817):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193)
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
10-30 15:06:07.584: ERROR/Database(817):     at com.fitzsoftware.grocessaryList.DataHelper.<init>(DataHelper.java:46)
10-30 15:06:07.584: ERROR/Database(817):     at com.fitzsoftware.grocessaryList.MyShoppingList.onCreate(MyShoppingList.java:63)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
10-30 15:06:07.584: ERROR/Database(817):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-30 15:06:07.584: ERROR/Database(817):     at android.os.Looper.loop(Looper.java:123)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread.main(ActivityThread.java:4203)
10-30 15:06:07.584: ERROR/Database(817):     at java.lang.reflect.Method.invokeNative(Native Method)
10-30 15:06:07.584: ERROR/Database(817):     at java.lang.reflect.Method.invoke(Method.java:521)
10-30 15:06:07.584: ERROR/Database(817):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
10-30 15:06:07.584: ERROR/Database(817):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
10-30 15:06:07.584: ERROR/Database(817):     at dalvik.system.NativeStart.main(Native Method)

The data which is being fetched from the database takes so much time to be displayed, which I think is because of this error. Any suggestions on how to solve it?

도움이 되었습니까?

해결책

Looks like you open the database but never close it...? Or maybe a corrupt database file...? Try uninstalling your program and run it again. Do you get the same error the first time you run it? - or the second time?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top