with this query I get a list of records from the database, and I order them according to the id, from smallest to largest. Now when the id of the query will change, compared to the previous, I want to add a day to the calendar. How can I do?
@Override
public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
List<WeekViewEvent> events = new ArrayList<WeekViewEvent>();
SQLiteDatabase db = new DatabaseHelper(getActivity()).getReadableDatabase();
String tabella_op = "SELECT id_operatore FROM Table ORDER BY id_operatore ASC";
Cursor cur = db.rawQuery(tabella_op, null);
while (cur.moveToNext()) {
id_operator = cur.getInt(0);
Calendar startTime = Calendar.getInstance();
//////////////////////////part of the code for the date change
if(op_confronto == id_operator){
startTime = Calendar.getInstance();
}else if(id_operator > op_confronto){
startTime.add(Calendar.DATE, 1);
op_confronto = id_operator;
}
////////////////////////////
...
...
}
cur.close();
db.close();
return events;
}