I want to set the minimum date the user can choose in a DatePicker to the current date. I\'ve tried this:
DatePicker datePicker = (DatePicker) findViewById(R
Adding this line to your DatePicker Fragment will set the minimum date as current date & disable the previous months.
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
If you don't want to use a custom dialog. Use this single line code:
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
OR
DatePickerDialog dialog = new DatePickerDialog(this, this,
Calendar.YEAR,Calendar.MONTH,
Calendar.DAY_OF_MONTH);
dialog.getDatePicker().setMinDate(Calendar.getInstance().getTimeInMillis());
dialog.show();