I am using default Android DatePickerDialog
which contains android.widget.DatePicker
.
Does anybody know how to disable or make certain dates unselectable?
I know DatePicker
allows to setMinDate()
and setMaxDate()
but it doesn't allow to disable specific dates in the middle.
e.g. on this picture would like to disable date 18, 26, etc:
I got a method by using custom datepicker. First we need to take the date as a string and then convert it into date object and then the date is converted to calendar object. At last by using setDisabledDays(calenderobj). We can disable it. The code is as follows.
That is not a built in behavior - you would have to use a custom date picker.