I'm having a problem with android and sqlite. When I receive data in the Arraylist the application crashes.
The DbHelper code is as follows:
ArrayList<String> array_list = new ArrayList<String>();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from "+TABLE_ACCELEROMETER_NAME+";", null );
res.moveToFirst();
while(res.isAfterLast() == false){
array_list.add(res.getString(1));
res.moveToNext();
}
return array_list;
}
The activity code is as follows:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_data);
mydb = new DbHelper(this);
ArrayList array_list = mydb.getAllAccelerometerRegists();
}
Aucun commentaire:
Enregistrer un commentaire