Note: Some of these steps use deprecated items.
1. Create a Click Handler for a Button, using a method named registerButtonListenersAndSetDefaultText and a private class level defined Button named myTimeButton.
2. Add a private class level integer constant named TIME_PICKER_DIALOG and set 1.
return showTimePicker();
4. Add a New method named updateTimeButtonText to your class, and call it from the registerButtonListenersAndSetDefaultText method, after the setOnClickListener.
5. In the onCreate method, Get Current Date/Time and Save to Calendar object with a private class level declared Calendar object named myCalendar.
6. Instantiate a TimePickerDialog object with the TimePickerDialog initial values of:
hour of: myCalendar.get(Calendar.HOUR_OF_DAY),
minute of: myCalendar.get(Calendar.MINUTE),
AM/PM of: true
7. In the onTimeSet method,
- set the Calendar.YEAR to the year variable
- set the Calendar.MONTH to the monthOfYear variable
- set the Calendar.DAY_OF_MONTH to the dayOfMonth variable
- then call the updateDateButtonText method
8. In the updateDateButtonText method, add a Format Calendar Date using SimpleDateFormat with a format of "yyyy-MM-dd".
9. Then set the Text for the Button named myTimeButton to the myString variable.
10. Compile and run!
Resources: