Exemplo n.º 1
0
  private List<DanceClass> extractDanceClassesFromDbResults(Cursor cursor) {
    List<DanceClass> danceClasses = new ArrayList<DanceClass>();

    if (cursor.moveToFirst()) {
      do {
        String className = cursor.getString(cursor.getColumnIndex(Constants.CLASS_NAME));
        String description = cursor.getString(cursor.getColumnIndex(Constants.DESCRIPTION_NAME));
        long id = cursor.getLong(cursor.getColumnIndex(Constants.KEY_ID));

        DanceClass danceClass = new DanceClass();
        danceClass.setName(className);
        danceClass.setDescription(description);
        danceClass.setId(id);

        danceClasses.add(danceClass);

      } while (cursor.moveToNext());
    }
    cursor.close();

    return danceClasses;
  }
Exemplo n.º 2
0
 public long insertClass(DanceClass danceClass) {
   return db.insertClass(danceClass.getName(), danceClass.getDescription());
 }