In this case, you can extend the DatePickerDialog and make your own implementation of OnDateChanged , which is called every time the date changes, and you get DatePicker parameters as well as the values ββof the new year, month and day, so you can check if this date has passed, and in this case throw an error (using Toast or something else) and call DatePicker.updateDate () to set the correct value (so that DatePicker is always in a consistent state).
Alternatively, you can call DatePicker.init(year, monthOfYear, dayOfMonth, onDateChangedListener); then you can pass
onDateChangedListener implementation without having to extend DatePickerDialog.
EDIT: (I never try to do this, but I think it can do your work ..)
Datepicker
setMinDate(long minDate)
Sets the minimum date that this NumberPicker supports in milliseconds since January 1, 1970, 00:00:00 in the getDefault () time zone.
Example:
DatePickerDialog dialog = new DatePickerDialog(this, mDateSetListener, cyear, cmonth, cday); dialog.getDatePicker().setMinDate(new Date());
source share