我在模拟器上运行了该应用程序,它工作正常,但是当我将它安装到设备中时它崩溃了。
这是导致崩溃的代码
c1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if ( c1.isChecked() )
{
SQLHandler check = new SQLHandler(StartMoving.this);
check.open();
check.updateTodo(currentMove, "sortandpurge", "Done");
check.close();
}else{
SQLHandler check = new SQLHandler(StartMoving.this);
check.open();
check.updateTodo(currentMove, "sortandpurge", "Not Done");
check.close();
}
}
});
这段代码的作用是,如果单击复选框,数据库将被更新。
public void updateTodo(String todoMove, String todoName, String todoValue){
ContentValues cv = new ContentValues();
cv.put(todoName, todoValue);
ourDatabase.update(DATABASE_TABLE4, cv, KEY_TODOMOVE + "='" + todoMove + "'", null);
}
但不知何故,应用程序在设备中崩溃,但在模拟器中没有
这是原木猫
09-27 02:59:05.743: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:05.763: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:08.153: D/dalvikvm(1130): GC_CONCURRENT freed 44K, 2% free 10692K/10823K, paused 11ms+10ms
09-27 02:59:08.213: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:08.343: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:08.724: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:08.853: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:09.223: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:09.353: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:09.403: D/dalvikvm(1130): GC_CONCURRENT freed 13K, 2% free 11222K/11335K, paused 6ms+7ms
09-27 02:59:09.723: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:09.763: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:10.243: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:10.293: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:10.733: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:10.863: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:11.234: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:11.353: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:11.743: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:11.863: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:12.233: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:12.363: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:12.723: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:12.803: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'
09-27 02:59:13.233: I/dalvikvm(1130): threadid=3: reacting to signal 3
09-27 02:59:13.363: I/dalvikvm(1130): Wrote stack traces to '/data/anr/traces.txt'