I am implementing a DateTimePicker. I have reuse this repository.
The problem appears when I am trying to catch the events for the onTimeChanged() method when I change the minutes. If I use the buttons of + and – it’s fine, the event is fired and I can handle it here:
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
// Update the internal Calendar instance
mCalendar.set(mCalendar.get(Calendar.YEAR),
mCalendar.get(Calendar.MONTH),
mCalendar.get(Calendar.DAY_OF_MONTH),
hourOfDay, minute);
}
Whereas when I click on the minutes and I change it using the keyboard the event doesn’t arise, as in the case of the hours, days, etc…
A more detail description of the problem is:
What steps will reproduce the problem?
- Select the time picker
- Touch on the numbers, so the keyboard appears
- when I write an amout of minutes, the event doesn’t fire
What is the expected output? What do you see instead?
I would expect to catch this event inside onTimeChanged(), but I cant.
What version of the product are you using? On what operating system?
Version 2. On Android Froyo.
The author of this code has told me there is a bug on Android. I think should be a work around to this problem, for example creating my own class extending from TimePicker and reimplementing the interface OnTimeChangedListener.
What is the best option to listen the timerPicker events?
DatePicker control must call clearFocus() in order to trigger
onFocusChanged() and that will fix the issue.
PFB the link that might help you :
http://code.google.com/p/android/issues/detail?id=2745
Thanks!