I'm using a Number Picker to set a timer value on the vivoactive in an app. To initialize it, I have a value of "timerValue" in seconds.
I convert it into a Duration, and then fire up the number picker. In the simulator, all is fine, but on the device, it has an initial value of 1 second!
Here's the code (timerValue is 0 at this point)
hr=timerValue/(3600);
min= (timerValue-(hr*3600))/60;
sec= timerValue%60;
Sys.println(hr+":"+min+":"+sec);
dur = Calendar.duration( {:hours=>hr, :minutes=>min, :seconds=>sec} );
Sys.println("dur="+dur.value());
//for up to 8hrs
np = new Ui.NumberPicker( Ui.NUMBER_PICKER_TIME, dur );
Ui.pushView( np, new NPTimer(), Ui.SLIDE_IMMEDIATE );
In both the simulator and on the device itself, the output from the println()'s are:
0:0:0
dur=0
If I have a non zero value in timerValue, it works fine....
update: on the real device, I can't set it to zero seconds, unless hour or minute is non zero.... So there is no way to set a zero duration on the va, but it's allowed in the simulator. I use a returned duration of "0" to specify the timer isn't used...