finally{
if(oCursorMood!=null){
oCursorMood.close();//记得一定要关闭游标和数据库
oCursorMood=null;
}
if(oCursorCMD!=null){
oCursorCMD.close();//关闭游标
oCursorCMD =null;
}
if (oClass!=null){
oClass.CloseDatabase();
oClass=null;
}
if (oDB!=null){
oDB.close();
oDB=null;
}
}
Finalizing a Cursor that has not been deactivated or closed. database = /storage/emulated/0/SMART-BUS/Database.db3, table = mood_commands_of_room, query = SELECT CommandID, SequenceNo, SubnetID, DeviceID, CommandTypeID, FirstParameter, SecondParameter, ThirdParameter, DelayMillisecondAfterSend FROM mood_commands_of_room WHERE RoomID=18 and MoodID=1 ORDER BY SequenceNO
android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:98)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:50)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1238)
at caro.automation.room.mood_of_room.LoadDataFromDB(mood_of_room.java:314)
at caro.automation.room.mood_of_room.onCreate(mood_of_room.java:238)
at android.app.Activity.performCreate(Activity.java:5248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.startActivityNow(ActivityThread.java:2024)
at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:749)
at android.widget.TabHost.setCurrentTab(TabHost.java:413)
at android.widget.TabHost.setCurrentTabByTag(TabHost.java:287)
at caro.automation.room.room_control$3.onCheckedChanged(room_control.java:332)
at android.widget.RadioGroup.setCheckedId(RadioGroup.java:174)
at android.widget.RadioGroup.access$600(RadioGroup.java:54)
at android.widget.RadioGroup$CheckedStateTracker.onCheckedChanged(RadioGroup.java:358)
at android.widget.CompoundButton.setChecked(CompoundButton.java:130)
at android.widget.CompoundButton.toggle(CompoundButton.java:87)
at android.widget.RadioButton.toggle(RadioButton.java:76)
at android.widget.CompoundButton.performClick(CompoundButton.java:99)
at android.view.View$PerformClick.run(View.java:18440)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
------解决思路----------------------
我只能推测到这里了.debug不出,你可以在这此语句前加打印语句,哪个没执行到就是哪个出问题了.