这是发生闪退处的代码,每次运行到cursor就会闪退
HistoryActivity是所在的activity
DataBaseHelper helper=new DataBaseHelper(HistoryActivity.this);
SQLiteDatabase db=helper.getWritableDatabase();
Cursor cursor=db.query("AccountingRecord",null,null,null,null,null,null);
DataBaseHelper:
public class DataBaseHelper extends SQLiteOpenHelper{
static String name="AccountingRecord.db";
static int dbVersion=1;
public DataBaseHelper(Context context){
super(context,name,null,dbVersion);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
String sql="create table AccountRecord(id integer primary key autoincrement,type varchar(20),state varchar(20),income double,date varchar(20))";
sqLiteDatabase.execSQL(sql);
}
@Override
publ