MaterialDateTimePicker
MaterialDateTimePicker copied to clipboard
Disable recurrent days.
Hello, is it possible disable (for example) all saturday of each month and year? or disable 25 dicember of each year? etc.
First get a list with your required dates - "holidaydata". You can use do while loop to get the Saturdays and Sundays for the given time period and add along with your other holdiays to this list.
Using setDisabledDays(disbledDays) you can disable these days.
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); java.util.Date date = null; for (String holidaydatum : holidaydata) { try { date = sdf.parse(holidaydatum); } catch (ParseException | java.text.ParseException e) { e.printStackTrace(); } calendar = dateToCalendar(date); List<Calendar> dates = new ArrayList<>(); dates.add(calendar); Calendar[] disbledDays = dates.toArray(new Calendar[dates.size()]); dpd.setDisabledDays(disbledDays); }