Disable the specific dates of the day in the Android date selection program

advertisements

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 DatePickerDialog();

             Calendar calender = Calendar.getInstance();
             long today = calender.getTimeInMillis();
             final long oneDay = 24 * 60 * 60 * 1000L;

             Date previousDays = new Date(today - 1000);
             datePicker.setMinDate(DateToCalendar(previousDays));

             Date nextMonth = new Date(today + 30 * oneDay);
             datePicker.setMaxDate(DateToCalendar(nextMonth));

If I want to disable Friday of every month, how can I do this?


You can use this library Material Date Time Picker, here you can set an option to show specific dates, For Example:

datePicker.setSelectableDays(Calendar[] days)

And pass array of Calendar as an parameter which contains all the selectable date.