1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
public ArrayList<Exercice> getExercices(int idSeance){
ArrayList<Exercice> exercices_list = new ArrayList<>();
String SqlQuery = "select nomExercice, nombreSeries, nombreRepetitions, Poids from Exercices where idSeanceCorrespondante = '" + idSeance + "'";
Cursor c = this.getReadableDatabase().rawQuery(SqlQuery, null);
int nomSeance = c.getColumnIndex("nomExercice");
int nombreSeries = c.getColumnIndex("nombreSeries");
int nombreRepetitions = c.getColumnIndex("nombreRepetitions");
int Poids = c.getColumnIndex("Poids");
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
String _nomSeance = c.getString(nomSeance);
int _nombreSeries = c.getInt(nombreSeries);
int _nombreRepetitions = c.getInt(nombreRepetitions);
int _Poids = c.getInt(Poids);
exercices_list.add(new Exercice(_nomSeance,_nombreSeries,_nombreRepetitions,_Poids));
}
return exercices_list;
} |
Partager