DatePickerDialog
is the simplest way to use DatePicker
, because you can show dialog anywhere in your app. You don't have to implement your own layout with DatePicker
widget.
How to show dialog:
DatePickerDialog datePickerDialog = new DatePickerDialog(context, listener, year, month, day);
datePickerDialog.show();
You can get DataPicker
widget from dialog above, to get access to more functions, and for example set minimum date in milliseconds:
DatePicker datePicker = datePickerDialog.getDatePicker();
datePicker.setMinDate(System.currentTimeMillis());