- On the Fenix3, FR735XT and VivoactiveHR it simply works.
- On the FR920XT, is does not work (shows 0, not changing).
- On the FR630 it initially works (just after restarting the device), but after opening an activity and returning to the watch screen, it does not work anymore (just shows 0).
Is this a bug in the firmware or documentation, or did I do something wrong in the implementation?
BTW: when creating the same as an app, it works fine on all devices.
Kind regards,
Harry
using Toybox.Application as App;
using Toybox.WatchUi as Ui;
using Toybox.Timer;
class TimerTestApp extends App.AppBase {
function initialize() {
AppBase.initialize();
}
//! Return the initial view of your application here
function getInitialView() {
return [ new TimerTestView() ];
}
}
class TimerTestView extends Ui.View {
var timer;
var tCount;
function initialize() {
View.initialize();
timer = new Timer.Timer();
tCount = 0;
timer.start(method(:update), 1000, true);
}
function update() {
tCount ++;
Ui.requestUpdate();
}
//! Load your resources here
function onLayout(dc) {
setLayout(Rez.Layouts.MainLayout(dc));
}
//! Update the view
function onUpdate(dc) {
// Call the parent onUpdate function to redraw the layout
View.findDrawableById("time_text").setText( tCount.toString());
View.onUpdate(dc);
}
}
// <layout id="MainLayout">
// <label id="time_text" x="100" y="100" font="Gfx.FONT_NUMBER_HOT" color="Gfx.COLOR_LT_GRAY" justification="Gfx.TEXT_JUSTIFY_CENTER" />
// </layout>