Android:DataBase中的问题

时间:2011-04-18 13:27:29

标签: java android sqlite

我创建了一个数据库,其中包含有关某些地方的信息..然后我从数据库中检索以显示Google地图上的地点..

当我调试应用程序时,此异常发生在IllegalStateException类中的“SQLiteCursor.finalize()”..

这是一个logcat输出:

04-18 14:58:51.815: ERROR/ActivityThread(263): Failed to find provider info for com.google.settings
04-18 14:58:51.825: ERROR/ActivityThread(263): Failed to find provider info for       com.google.settings
04-18 14:58:51.975: ERROR/ActivityThread(263): Failed to find provider info for com.google.settings
04-18 14:58:52.845: DEBUG/dalvikvm(263): GC freed 3178 objects / 193168 bytes in 80ms
04-18 14:58:53.445: ERROR/Database(263): Leak found
04-18 14:58:53.445: ERROR/Database(263): java.lang.IllegalStateException: /data/data/ksu.project.gotour/databases/GoTour.db SQLiteDatabase created and never closed
04-18 14:58:53.445: ERROR/Database(263):     at android.database.sqlite.SQLiteDatabase. <init>(SQLiteDatabase.java:1694)
04-18 14:58:53.445: ERROR/Database(263):     at   android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:738)
04-18 14:58:53.445: ERROR/Database(263):     at   android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:760)
04-18 14:58:53.445: ERROR/Database(263):     at   android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:753)
04-18 14:58:53.445: ERROR/Database(263):     at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:473)
04-18 14:58:53.445: ERROR/Database(263):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193)
04-18 14:58:53.445: ERROR/Database(263):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
04-18 14:58:53.445: ERROR/Database(263):     at   ksu.project.gotour.EventData.Visited(EventData.java:236)
04-18 14:58:53.445: ERROR/Database(263):     at ksu.project.gotour.spotInfo$2.onCheckedChanged(spotInfo.java:73)
04-18 14:58:53.445: ERROR/Database(263):     at android.widget.CompoundButton.setChecked(CompoundButton.java:122)
04-18 14:58:53.445: ERROR/Database(263):     at android.widget.CompoundButton.toggle(CompoundButton.java:85)
04-18 14:58:53.445: ERROR/Database(263):     at android.widget.CompoundButton.performClick(CompoundButton.java:97)
04-18 14:58:53.445: ERROR/Database(263):     at android.view.View.onTouchEvent(View.java:4179)
04-18 14:58:53.445: ERROR/Database(263):     at android.widget.TextView.onTouchEvent(TextView.java:6540)
04-18 14:58:53.445: ERROR/Database(263):     at android.view.View.dispatchTouchEvent(View.java:3709)
04-18 14:58:53.445: ERROR/Database(263):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-18 14:58:53.445: ERROR/Database(263):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-18 14:58:53.445: ERROR/Database(263):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-18 14:58:53.445: ERROR/Database(263):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-18 14:58:53.445: ERROR/Database(263):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-18 14:58:53.445: ERROR/Database(263):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
04-18 14:58:53.445: ERROR/Database(263):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
04-18 14:58:53.445: ERROR/Database(263):     at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
04-18 14:58:53.445: ERROR/Database(263):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
04-18 14:58:53.445: ERROR/Database(263):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
04-18 14:58:53.445: ERROR/Database(263):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-18 14:58:53.445: ERROR/Database(263):     at android.os.Looper.loop(Looper.java:123)
04-18 14:58:53.445: ERROR/Database(263):     at android.app.ActivityThread.main(ActivityThread.java:4363)
04-18 14:58:53.445: ERROR/Database(263):     at java.lang.reflect.Method.invokeNative(Native Method)
04-18 14:58:53.445: ERROR/Database(263):     at java.lang.reflect.Method.invoke(Method.java:521)
04-18 14:58:53.445: ERROR/Database(263):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-18 14:58:53.445: ERROR/Database(263):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-18 14:58:53.445: ERROR/Database(263):     at dalvik.system.NativeStart.main(Native Method)
04-18 14:58:53.805: DEBUG/dalvikvm(263): GC freed 844 objects / 73448 bytes in 135ms
04-18 14:58:54.176: ERROR/Exception on query(263): java.lang.NumberFormatException: 
04-18 14:58:57.075: DEBUG/dalvikvm(263): threadid=5: still suspended after undo (sc=1 dc=1 s=Y)
04-18 14:58:57.075: DEBUG/dalvikvm(263): GC freed 5454 objects / 334000 bytes in 92ms
04-18 14:59:00.556: INFO/MapActivity(263): Handling network change notification:CONNECTED
04-18 14:59:03.896: INFO/dalvikvm(263): Debugger is attached -- suppressing HeapWorker watchdog

这是logcat的图片。也许它更清楚。

http://download.mrkzy.com/e/1811_md_13031326851.png http://download.mrkzy.com/e/1811_md_13031326852.png

非常感谢

1 个答案:

答案 0 :(得分:0)

如果您不再需要游标,则可以显示异常"SQLiteCursor.finalize()" in IllegalStateException Class。所以,不要忘记为游标执行close()。 这不是关键异常,因此应用程序可以使用它,但是当调试eclipse时会破坏此异常。