views:

78

answers:

2

Hello again...

I have a widget which is a TimePicker that retrieves the time saved in a field in a database.

Thing is that when the user changes the time value in the widget, this is not being saved in the database.

So I came across the setOnTimeChangedListener method that works like a charm, if you are only using the plus and minus signs in the widget. It does not capture the change if you are using the keyword.

Here is my code:

pickedTime.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {

        public void onTimeChanged(TimePicker arg0, int arg1, int arg2) {
            System.out.println("What time is it? "
                    + String.valueOf(arg0.getCurrentHour()) + ":"
                    + String.valueOf(arg0.getCurrentMinute()));
        }

    });

I've also tried unsuccessfully:

pickedTime.setOnFocusChangeListener and pickedTime.setOnKeyListener methods.

Thanks in advance,

monn3t

+1  A: 

addstatefromchildren="true" doesn't work for me. Can you tell me how you made it work more specifically? Thanks in advance.

Yonk
Well.. it didn't at first, but it worked using it together with the method:pickedTime.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener()){}I discovered that if I removed this method, it wouldn't capture what the keyword did on the hour and minute fields individually.I hope this help!monn3t
monn3t
A: 

Setting add states from children to true doesn't work for me either. This is really a stupid problem. :( Anyone ...?

Franklin