I'm really confused. It seems, from looking at other peoples code, there are multiple ways of doing the same thing (e..g setting background color, setting background image, etc).
Is there a tutorial I can follow anywhere?
Amir
I'm really confused. It seems, from looking at other peoples code, there are multiple ways of doing the same thing (e..g setting background color, setting background image, etc).
Is there a tutorial I can follow anywhere?
Amir
var background;
function onLayout(dc) {
background = Ui.loadResource(Rez.Drawables.Background);
}
function onUpdate(dc) {
dc.drawBitmap(0,0,background);
}
function onUpdate(dc) {
var foregroundColor = Gfx.COLOR_RED;
var backgroundColor = Gfx.COLOR_BLACK;
dc.setColor(foregroundColor, backgroundColor );
dc.clear(); //this makes the screen be the color in backgroundColor
}
function onUpdate(dc) {
var screenWidth = dc.getWidth();
var screenHeight = dc.getHeight();
var foregroundColor = Gfx.COLOR_BLACK;
var backgroundColor = Gfx.COLOR_RED;
dc.setColor(foregroundColor , backgroundColor );
dc.fillRectangle(0, 0, screenWidth, screenHeight); //this makes the screen be the color that was in foregroundColor
}
class AppView extends Ui.DataField {
var background;
function onLayout(dc){
background = Ui.loadResource(Rez.Drawables.background);
// background is now a BitmapResource instance
}
...
function onUpdate(dc) {
...
dc.drawBitmap(0, 0, background);
}
I tried to look up MoxyDataField example in ConnectIQ SDK as suggested. I can't see it loading a background image.
It complies OK but return with the following error when Run
Failed invoking <symbol>
Out Of Memory Error
in onLayout (/Users/<username>/Documents/workspace/<AppName>/source/<AppName>View.mc:19)
Connection Finished
Any other data field sample that load a background image please?