I thought it'd be cool to be able to have different background images based on things like "time of day."
So, I wrote a simple watch face app and ran into a snag. I think I used up too much memory when loading resources.
I've been using Ui.loadResource() to load just two images in the onLayout function.
What's odd is it works in the simulator, but not on my vivoactive watch.
By removing the loading and use of the second background image, everything runs fine. Either image, so it's not the image itself causing grief.
Is there a way to unload a resource, then add another from within the program? The total size of the app was about 121k.
Just FYI, I'm rather new to this.
Thanks!
The coded goes something like this:
class garminsimplewatchfaceView extends Ui.WatchFace {
var picOne;
var picTwo;
//! Load your resources here
function onLayout(dc) {
picOne = Ui.loadResource(Rez.Drawables.id_picOne);
picTwo = Ui.loadResource(Rez.Drawables.id_picTwo);
}
//! Restore the state of the app and prepare the view to be shown
function onShow() {
}
//! Update the view
function onUpdate(dc) {
// Get date/time strings
var moment = Time.now();
if (info.min % 2 == 0) {
dc.drawBitmap(bgX, bgY, picOne);
}else{
dc.drawBitmap(bgX, bgY, picTwo);
}