Help with Resource Folder

I've set up resource folder's for multiple devices such as 390x390, 280x280, etc.

I am trying to customize the code for heart rate, date and other texts but I do not see any change whatsoever. 

In the View.mc folder, the following code works perfectly to draw the hr:

      dc.setColor(Application.getApp().getProperty("ForegroundColor"),Gfc.COLOR_TRANSPARENT);

      dc.drawText(0,0,Gfx.FONT_SMALL, hr,Gfx.TEXT_JUSTIFY_LEFT);

In order to customize the draw on other devices, I've tested the string listed below in the respective layout folder and the resources folder similar to the "PluralsightTribute" SDK. Does anyone know what is the best way to display these in multiple devices?

The below codes are the ones I've tried using in the layout or resource file, but I have seen no change when I select the appropriate device... What am I missing?

Any help would be appreciated!

<layout id="WatchFace">

    <label id="ShowHeartRateLabel" x="0" y="0" font="Graphics.FONT_SMALL" justification="Graphics.TEXT_JUSTIFY_LEFT" />

    <label id="HeartrateDisplay" text="000" x="0" y="0" font="@Fonts.smallFont" justification="Gfx.TEXT_JUSTIFY_CENTER" color="Gfx.COLOR_WHITE" />    

</layout> 

  • Sorry, I gave you slightly bad advice and didn't read carefully enough, although the test you did isn't bad.

    You want to use an id that's valid, but doesn't match the one in your code (e.g. "WatchFace1"). Or even easier, just move away all the resource folders except for the one for the device where you think the appropriate resource folder isn't being used. That way you can say an error such as "Unknown symbol WatchFace" (or whatever), which would indicate the compiler isn't looking for resources in the right place (as you theorized)

    For example, if you think the the 390x390 build isn't working, move away all resource folders except for "resource" and "resource-round-390x390". If you have "WatchFace" defined in the main resource folder, temporarily rename that id to a valid but unused name such "WatchFace1". In other words, "resource-round-390x390" should be the only folder that has "WatchFace" defined.

    Now if you build, you should see an error about "WatchFace" not existing. If you see that error it will prove that "resource-round-390x390" isn't being used as a resource folder location (as it should be). (Either that or your 390x390 folder is misnamed or in the wrong location.)

  • This is interesting. Here are the steps I took.

    #1. I moved all the resource folders away from the main file. I only kept the main resource folder and the 390 folder (picture below shows a snapshot).

    #2. I renamed WatchFace to WatchFace1 as you mentioned in the main resource folder. I kept WatchFace in the 390 folder.

    #3. I build, but did not see an error. However, I started to modify the main resource folder to " _WatchFace" and immediately saw an error. So I switched back to "WatchFace1".

  • Right but we've established that "_WatchFace" is literally an invalid ID.(Sorry for the bad initial advice. I actually wanted you to use an *unused ID*, not one that's literally invalid)

    And we know that the compiler will always initially look in the main resource folder, by default.

    So if you're able to build with WatchFace1 in the main folder and WatchFace in the 390x390 folder, then whatever's in the latter folder is being used, as expected. You should be able to make changes there and see them reflected in your watchface.

    If you doubt that, change both the main folder and 390x390 folder's layout id to WatchFace1. You should see a compile error. Change the 390x390 folder's layout id back to WatchFace. It should build now. If it doesn't build, then there's def a compiler problem.

  • So I changed the main folder and the 390x390 folder to WatchFace1. Both sims worked well. No change or error.

    I used showHeartRate as the "id" ... is this the correct nomenclature? Or should I use "hr" as the "id"? Or maybe the layout is not the right folder to be used? I also tried applying this code to the the resources file within the resources folder but I did not see change.

  • So that sounds like you literally have no layout resources named WatchFace anymore. Again, the point is to demonstrate that your code is not using the WatchFace layout, since it's now named something else that is surely not referenced in your code.

    The "nomenclature" is almost completely arbitrary (as long as you use valid identifiers). The point is to use names that make sense to you, and most importantly, to actually *use* any defined resources in your code. It doesn't matter whether you call a resource "showHeartRate", "hr", or "x", for example. What matters is how you use the resource (or whether it's used at all).