How do you put a list in the properties?

The example given for settings (https://developer.garmin.com/connect-iq/core-topics/app-settings/) has a list in the settings.xml file:

    <setting propertyKey="@Properties.myString" title="@Strings.MyStringTitle" prompt="@Strings.MyStringPrompt">
        <settingConfig type="list">
            <listEntry value="0">@Strings.HelloWorld</listEntry>
            <listEntry value="1">@Strings.Ackbar</listEntry>
            <listEntry value="2">@Strings.Garmin</listEntry>
        </settingConfig>
    </setting>

However, I cannot find a properties.xml file to go with it and cannot work out how is it supposed to work.

If I don't put the property in I get the error: ERROR: Property not found for the property key 'myString'.

How is this supposed to work please?

  • I typically put properties, strings for setting, and settings in the same xml file. Stings could be separate if you want to localize.
     So for the above

    <resources>
        <properties>
            <property id="myString" type="number">0</property>
        </properties>
        
        <strings>      
            <string id="MyStringTitle">My Title</string>
            <string id="MyStringPrompt">My Prompt</string>
            <string id="HelloWorld">Hello World</string>
            <string id="Ackbar">Achbar</string>
            <string id="Garmin">Garmin!</string>
        </strings>
        
        <settings>
            <setting propertyKey="@Properties.myString" title="@Strings.MyStringTitle" prompt="@Strings.MyStringPrompt">
                <settingConfig type="list">
                    <listEntry value="0">@Strings.HelloWorld</listEntry>
                    <listEntry value="1">@Strings.Ackbar</listEntry>
                    <listEntry value="2">@Strings.Garmin</listEntry>
                </settingConfig>
            </setting>
        </settings>
    </resources>
    
    

  • Can you have list entries with a string value? E.g.


    <listEntry value="Zero">@Strings.HelloWorld</listEntry>

    <listEntry value="One">@Strings.HelloWorld</listEntry>

  • I don't think so.  I did a quick test where I change the property type to be a string and tried to use a list and I get

    ERROR: fenix5plus: C:\Users\James\workspace-prod\SimLeanWU\resources-basic\properties\properties.xml:109: The setting defined for property 'aaa' is an invalid setting type (list) for the property type 'string'.

  • Same. Thanks for checking.