Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Last active December 10, 2019 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magdamiu/5f7b1a6871cd80c905200102682195d8 to your computer and use it in GitHub Desktop.
Save magdamiu/5f7b1a6871cd80c905200102682195d8 to your computer and use it in GitHub Desktop.
DatePicker example
final Calendar c = Calendar.getInstance();
year = c.get(Calendar.YEAR);
month = c.get(Calendar.MONTH);
day = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
textViewDate.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
}
}, year, month, day);
datePickerDialog.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment