Disable future dates from DatePickerDialog in Android
As we already know DatePickerDialog will be used to allow user to select date. It is useful when user wants to select Date of Birth or Start Date or End Date etc.
Here is the small code snippet of creating DatePickerDialog.
1 2 3 4 5 6 7 |
Calendar calendar = Calendar.getInstance(); int mYear = calendar.get(Calendar.YEAR); int mMonth = calendar.get(Calendar.MONTH); int mDay = calendar.get(Calendar.DAY_OF_MONTH); DatePickerDialog dpDialog = new DatePickerDialog(this, myDateListener, mYear, mMonth, mDay); dpDialog.show(); |