viernes, 24 de junio de 2011

Problem with DatePicker example on Android. Possible Android bug.

I am implementing a DateTimePicker. I have reuse this repository:

http://code.google.com/p/datetimepicker/

The problem appears when I am trying to catch the events for the onTimeChanged when I change the minutes. If I use the buttons of + and – Its 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 doesnt arise, as in the case of the hours, days, etc…

A more detail description of the problem is:

What steps will reproduce the problem?

1. Select the timepicker

2. touch on the numbers, so the keyboard appear

3. when i write an amout of minutes, the event doesnt 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.

No hay comentarios: