I want to disable the specific dates which user selected in another date picker I mean user selects date in first date in date picker and another date picker sets minimum date?
Asked
Active
Viewed 320 times
1
-
please provide some code and explain what exactly is your problem – Pouya Danesh Jul 18 '18 at 12:00
-
1Please check this https://stackoverflow.com/questions/33051236/android-datepickerdialog-set-min-and-max-date-for-selection link to set minimum data in date picker – Faldu Jaldeep Jul 18 '18 at 12:02
-
@FalduJaldeep this example set past dates from current system date. i want to disable specic date provided by user – user1 Jul 18 '18 at 12:05
2 Answers
1
you can use setMinDate() function to set the minimum date in date picker.

Prasanth
- 217
- 1
- 2
- 10
-
Can write an example. suppose i have three int as date month year. Now how can i set min date – user1 Jul 18 '18 at 12:00
-
you can use the below code to set minimum date in date picker dialog. Calendar mCalendar=Calendar.getInstance(); mCalendar.set(Calendar.YEAR, year); mCalendar.set(Calendar.MONTH, monthOfYear); mCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); mDatePickerDialog.setMinDate(mCalendar.getTimeInMillis()); – Prasanth Jul 18 '18 at 12:19
1
That functionality does not available in Android DatePicker. You need to use a custom date picker.
You can use MaterialDateTimePicker library, here you can set an option to disable specific dates by using setDisabledDays() API.
For Example:
datePicker.setDisabledDays(Calendar[] days)
You need to pass array of Calendar
days as an parameter which should contains all the disable dates.

Priyank Patel
- 12,244
- 8
- 65
- 85