Skip to content

Instantly share code, notes, and snippets.

Last active Jul 18, 2017
What would you like to do?
public void showDatePickerDialog(final View v) {
Calendar cal = Calendar.getInstance();
DatePickerDialog datePickerDialog = new DatePickerDialog(v.getContext(),,
new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
Calendar calendarInstance = Calendar.getInstance();
calendarInstance.set(year, monthOfYear, dayOfMonth);
((EditText) v).setText(df.format(calendarInstance.getTime()));
}, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE));;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment