Closed chrisonline closed 9 years ago
This is because you only initialize it once on creation I think.
I have done this before like this in your library: @Override public void onFooterClick() { if (customDatePicker == null) { Calendar selectedDate = getSelectedDate(); datePickerDialog.initialize(this, selectedDate.get(Calendar.YEAR), selectedDate.get(Calendar.MONTH), selectedDate.get(Calendar.DAY_OF_MONTH), hasVibratePermission(context)); datePickerDialog.show(fragmentManager, "DatePickerDialog"); } else { customDatePicker.onClick(this); } }
And implemented the OnDateSetListener:
@Override
public void onDateSet(DatePickerDialog datePickerDialog, int year,
int month, int day) {
setSelectedDate(new GregorianCalendar(year, month, day));
}
Thanks for bringing this up, should've thought of that from the start, of course the selected item in the Date/TimePicker has to match the spinner's selection ;). It turns out the datetimepicker's method signatures are not as clear and straight-forward as I would've liked, but I found what I needed.
As always, great work! Thanks again.
How do I set the start time and date for the pickers? At the moment the date and time picker always opens with the current date and time.
I want to open it with the actual value of the spinner.
I've tried to use the new getDatePickerDialog/getTimePickerDialog with "setSelectedDay" and "setStartTime", but it does not work and gets ignored.