I\'m using the datePicker and I can disable last days of today and later days after 30 days by the following code:
DatePickerDialog datePicker = new DatePick
Visit https://stackoverflow.com/a/44692231/6631959 Best method and easy to understand... if u are searching for how to disable a specified date it is better. not a looping procedure. giving any exact date and disabling it.
The code is HEre::
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
String a = "26-07-2017";
java.util.Date date = null;
try {
date = sdf.parse(a);
MainActivity obj = new MainActivity();
calendar = obj.dateToCalendar(date);
System.out.println(calendar.getTime());
} catch (ParseException e) {
e.printStackTrace();
}
List dates = new ArrayList<>();
dates.add(calendar);
Calendar[] disabledDays1 = dates.toArray(new Calendar[dates.size()]);
dpd.setDisabledDays(disabledDays1);
private Calendar dateToCalendar(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
}