I don't know why the screen crash when flip to widget or back to watchface.
code:
function onUpdate(dc) {
var width = dc.getWidth();
var height = dc.getHeight();
// Get the current time and format it correctly
var timeFormat = "$1$:$2$";
var clockTime = Sys.getClockTime();
//var hours = clockTime.hour;
//if (!Sys.getDeviceSettings().is24Hour) {
// if (hours > 12) {
// hours = hours - 12;
// }
//} else {
// if (App.getApp().getProperty("UseMilitaryFormat")) {
// timeFormat = "$1$$2$";
// hours = hours.format("%02d");
// }
//}
//var timeString = Lang.format(timeFormat, [hours, clockTime.min.format("%02d")]);
// Update the view
//var view = View.findDrawableById("TimeLabel");
// view.setColor(App.getApp().getProperty("ForegroundColor"));
//view.setText(timeString);
//view.setColor(App.getApp().getProperty("ForegroundColor"));
dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT);
//Ui.loadResource(Rez.Fonts.fntTime)
var font = Ui.loadResource(Rez.Fonts.fntTime);
var fontSize = 74;
dc.drawText(width/2-1, (height-74)*clockTime.hour/24.0f, font, clockTime.hour/10, Gfx.TEXT_JUSTIFY_RIGHT);
dc.drawText(width/2+1, (height-74)*clockTime.min/60.0f, font, clockTime.hour%10, Gfx.TEXT_JUSTIFY_LEFT);
//dc.setColor(Gfx.COLOR_LT_GRAY, Gfx.COLOR_LT_GRAY);
//dc.drawCircle(100, 100, 7);
ZDebug.log("updated time position"+(height-74));
// Call the parent onUpdate function to redraw the layout
//View.onUpdate(dc);
//Ui.animate(drawable, property, type, start, stop, period, callback)
}