Created
October 21, 2015 01:54
-
-
Save sdanna/4b052f25323766cd2fa5 to your computer and use it in GitHub Desktop.
Wire up DatePicker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void setDateFields(){ | |
entryDate.setOnClickListener(this); | |
Calendar calendar = Calendar.getInstance(); | |
datePickerDialog = new DatePickerDialog(mThis, new DatePickerDialog.OnDateSetListener() { | |
@Override | |
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { | |
Calendar newDate = Calendar.getInstance(); | |
newDate.set(year, monthOfYear, dayOfMonth); | |
entryDate.setText(dateFormatter.format(newDate.getTime())); | |
} | |
}, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment