Articles → Android → Datepicker Dialog In Android
Datepicker Dialog In Android
Example
Click to Enlarge
@Nullable
@Override
protected Dialog onCreateDialog(int id) {
return new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
TextView textView = (TextView) findViewById(R.id.tvGetDate);
textView.setText(String.valueOf(year) +
"-" + String.valueOf(month) + "-" + String.valueOf(dayOfMonth));
}
}, 2019, 10, 31);
}
Output
Click to Enlarge
Click to Enlarge