I've no experience in coding but I have been attempting to design my own watch face. So far, I have gotten the date and time the way I like it based on some stuff I found via google. But I have not had any success on steps. I have googled around and check various sources (including asking for tips from one of the senior members here) but couldn't figure out how to do it. The sample found in the sample folder of the SDK does it in terms of a bar and I can't for the life of me figure out how to change that to integers. So I was wondering if someone can see where I went wrong. I got the watch face to show, but the steps counter doesn't. And when I simulated the steps data, nothing changes until I get an error message:
"Failed invoking <symbol>
Invalid Font Specified
in onUpdate (C:\Users\....\workspace\bare_bones\source\bare_bonesView.mc:43)
using Toybox.WatchUi as Ui;
using Toybox.Graphics as Gfx;
using Toybox.System as Sys;
using Toybox.Lang as Lang;
using Toybox.Time as Time;
using Toybox.Time.Gregorian as Calendar;
using Toybox.ActivityMonitor as Act;
class bare_bonesView extends Ui.WatchFace {
function initialize() {
WatchFace.initialize();
}
// Load your resources here
function onLayout(dc) {
setLayout(Rez.Layouts.WatchFace(dc));
}
// Called when this View is brought to the foreground. Restore
// the state of this View and prepare it to be shown. This includes
// loading resources into memory.
function onShow() {
}
// Update the view
function onUpdate(dc) {
// Get and show the current day
var dateInfo = Calendar.info( Time.now(), Calendar.FORMAT_MEDIUM );
var dateString = Lang.format("$1$ $2$ $3$", [ dateInfo.day_of_week, dateInfo.day, dateInfo.month ]);
var date = View.findDrawableById("DateLabel"); date.setText(dateString);
// Get and show the current time
var clockTime = Sys.getClockTime();
var timeString = Lang.format("$1$:$2$", [clockTime.hour.format("%02d"), clockTime.min.format("%02d")]);
var view = View.findDrawableById("TimeLabel");
view.setText(timeString);
// Get and show the steps (this part's screwed)
var activityInfo = Act.getInfo();
var stepsString = activityInfo.steps;
dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_BLACK);
dc.drawText(50, 100, stepsString, Gfx.FONT_SYSTEM_LARGE, Gfx.TEXT_JUSTIFY_RIGHT);
// end of screwed part
// Call the parent onUpdate function to redraw the layout
View.onUpdate(dc);
}
// Called when this View is removed from the screen. Save the
// state of this View here. This includes freeing resources from
// memory.
function onHide() {
}
// The user has just looked at their watch. Timers and animations may be started here.
function onExitSleep() {
}
// Terminate any active timers and prepare for slow updates.
function onEnterSleep() {
}
}