I am adding to an array list every SATURDAY and SUNDAY date of the month, for the first 3 months.
However, when I iterate through the array, to check if the values are actually correct, I seem to get only a few elements (with the size of the array still being correct though -> E.g. only two elements in the array, while the size is 26).
Any help?
info.setContentView(R.layout.calendar_dialog);
CalendarView calendarView = info.findViewById(R.id.calendarView);
Calendar currentDate = Calendar.getInstance();
Calendar max = Calendar.getInstance();
max.add(Calendar.MONTH,3);
calendarView.setMinimumDate(currentDate);
calendarView.setMaximumDate(max);
Calendar temp = Calendar.getInstance();
ArrayList<Calendar> calendars = new ArrayList<>();
calendars.add(temp);
while(temp.get(Calendar.MONTH) < max.get(Calendar.MONTH)) {
temp.add(Calendar.DATE, 1);
if(temp.get(Calendar.DAY_OF_WEEK) == 1 || temp.get(Calendar.DAY_OF_WEEK) == 7) {
calendars.add(temp);
}
}
calendarView.setDisabledDays(calendars);
info.findViewById(R.id.calendar_ok).setOnClickListener(v -> info.dismiss());
info.show();