tags:

views:

123

answers:

2

I am using a TimePicker under API 1.5 and when the orientation is changed on my device (a stock G1 running 1.6 - though NOT on the 1.5/1.6 emulator), the hour field goes blank. It still remembers the hour, it just doesn't show it. Is there any workaround for this?

The same problem was described by someone else here:

http://groups.google.com/group/android-beginners/browse_thread/thread/b4288004021b876/de5899a2bb291ab5

Nothing helpful was forthcoming - can StackOverflow do better?

A: 

In onSaveInstanceState() for your activity, get the hour value out of the TimePicker and place it in the Bundle. In onRestoreInstanceState() for your activity, get the hour out of the Bundle and put it in the TimePicker.

TimePicker should handle that on its own, but this may work around the problem for you.

CommonsWare
Thanks for the suggestion. Unfortunately it doesn't change anything. Interestingly, when I debugged in to see what happens on this time "change," I saw that ultimately TimePicker calls (internally) `onTimeChanged()`, and the only listener I ever see set for that is NO_OP_CHANGE_LISTENER.I also tried calling `invalidate()` on the TimePicker during `onResume()`. No luck.It's as if there's a setting somewhere that specifies not to show the hour; because it's being redrawn (obviously), it paints the container for the number, it keeps the existing value; it simple doesn't show the number.
sosiouxme
A: 

Simply move invoking of methods TimePicker.setCurrentHour and TimePicker.setCurrentMinute to onResume method of your Activity.

kulikoff