4

There's a bug on Android L that even if a min and max date is set, user can still select disabled dates.

Screenshot

I've already filed an issue here, but I'm wondering is there's any solution to fix this before next android system update?

sbhhbs
  • 625
  • 4
  • 15
  • Been looking around myself, no solution has presented itself. – slycrel Jan 26 '15 at 22:59
  • you can compare it with current system date and put some condition based on that. I used this as my workaround – karan Sep 01 '15 at 12:01
  • Hi, You can refer this [LINK](https://android--code.blogspot.in/2015/08/android-datepickerdialog-set-max-date.html). I know is not for lollipop, but I have recently worked on this for Lollipop. You have to just do like `DatePickerDialog.getDatePicker().setMaxDate(newCalendar.getTimeInMillis());` for setting max date to current date. – Maulik Dodia Nov 17 '16 at 10:36

1 Answers1

-1

Here the perfect answer for you. Please, Refer ozbek's answer. Code is like below, In case if above link will get break in future.

DatePickerDialog dialog = new DatePickerDialog(this, pDateSetListener, pYear, pMonth, pDay);
dialog.getDatePicker().setMaxDate(new Date().getTime());

Do same for setminDate().

Enjoy..!

Community
  • 1
  • 1
Maulik Dodia
  • 1,629
  • 2
  • 21
  • 48