I had a Date Picker Dialogue in which i need to show current date in that dialogue and the previous dates should be disabled and should be shown in the date picker dialogue.Only future dates should be shown not previous date in date picker dialogue
Asked
Active
Viewed 57 times
2 Answers
0
You should use setMinDate()
and setMaxDate()
methods of DatePicker
class.
This will disable all previous dates prior to current date, but you can also set any other date. Just remember to calculate this date in milliseconds from epoch
datePickerDialog().getDatePicker().setMinDate(System.currentTimeMillis());
And this will disable all dates after today
datePickerDialog().getDatePicker().setMaxDate(System.currentTimeMillis());

Asim Gasimzade
- 75
- 1
- 9