Changing Datafield text color or background depending on thresholds

Hello everyone,

I am working on a data field and I am trying to get it to change text color during the activity depending on thresholds. Eg: HR, if > than 150 show text red, if <=150 show text green

(When I say text, it is literally the sensor value and text labels).

Here is what I am using:

if (colorToSelect == 1) {
                label.setColor(Graphics.COLOR_BLACK);
                value.setColor(Graphics.COLOR_BLACK);
            } else if (colorToSelect == 2) {
                label.setColor(Graphics.COLOR_GREEN);
                value.setColor(Graphics.COLOR_GREEN);
            } else if (colorToSelect == 3) {
                label.setColor(Graphics.COLOR_YELLOW);
                value.setColor(Graphics.COLOR_YELLOW);
            } else if (colorToSelect == 4) {
                label.setColor(Graphics.COLOR_RED);
                value.setColor(Graphics.COLOR_RED);
            }
colorToSelect is a function that defines the color.
When I test it on the simulator it works fine and changes colors fine, but when I move to an actual device it does not change the color of the Datafield and it is all the time Black. Is there something that I am missing?
Also, this all sits on a Complex Datafield with onUpdate(). 

Any comment or guidance will be appreciated.
Thanks!
  • Hello again,

    So it looks like I got it resolved. Looks like this works for Complex Data Fields that use the onUpdate().

    The problem was that after updating one property (I use one user input for a variable that I am getting through Connect IQ) you have to press Sync for the smartphone to send that information forcefully to the watch. Looks like everything is working fine!