Is possible??

Hello.

instead of 

<setting propertyKey="@Properties.arc_boards" title="@Strings.arc_boards_title" prompt="@Strings.arc_boards_title">
    <settingConfig type="list" >
    	<listEntry value="0">@Strings.board_1</listEntry>
    	<listEntry value="1">@Strings.board_2</listEntry>
    	<listEntry value="2">@Strings.board_3</listEntry>
    	<listEntry value="3">@Strings.board_4</listEntry>
    	<listEntry value="4">@Strings.board_5</listEntry>
    </settingConfig>

is possible that each user can add their boards ?? and that boards be saved somewhere on the watch to be used when the user go windsurfing and choose what board will use??

is like a database to store boards, sails, fins... 

I have this static menu 

            
            ....
            
            else if (item.getId().equals("item_board")) { 
                           
                var menu_sub = new WatchUi.Menu2({:title=>"Board Size"});

                menu_sub.addItem(new WatchUi.MenuItem("160", null, "board160", null));
                menu_sub.addItem(new WatchUi.MenuItem("127", null, "board127", null));
                menu_sub.addItem(new WatchUi.MenuItem("116", null, "board116", null));
                menu_sub.addItem(new WatchUi.MenuItem("80",  null, "board80",  null));
                
                ....

and would be something like

var menu_sub = new WatchUi.Menu2({:title=>"Board Size"});

for (.....) {
menu_sub.addItem(new WatchUi.MenuItem(...));
}

is this possible??

  • I have a similar issue in my app, and although you can do it, but it might be a bit ugly to use it.
    1. You could add settings where the user can enter their boards, and call them as they want. You'll need to decide in advance how many boards do you support: b1, b2 ,b3,...

    2. The question is how does the user chose which of those he is using for the activity.

    2.1. on-watch settings: In my app I don't have enough free memory to be able to even try to use settings on the watch (which I don't know how useful would be for a data-field anyway) but arguably it would be probably more useful than the other option which is to have it

    2.2. in regular (GCM or GE) settings:

    To have them in the settings has 2 issues:

    a. the user needs to have the phone with him or at least remember to set it before he leaves the phone (at home or in the car in your case)

    b. you won't be able to display a user friendly list (with the names that the user typed in the previous section of the settings) only to refer to them (you could use 1 / 2 / 3)

    I think that when you have the settings in the watch then you could read the values of b1,b2,b3 and using their values build the menu where the user sees the name and thus it's more user friendly (plus they don't need the phone, so they can do this in the water right when they start the activity) But again I did not try settings on the watch for datafield, so it's just wishful thinking. 

  • Thanks for your answer!

    Maybe what I would like to do is impossible Disappointed

    This APP will be only for me...

    Thanks again!

  • You may want to consider a string in app setting, where you use a delimiter to seperate the names and then pull them apart in your app, like

    "Red Board|Big Board|Blue Board|Tiny Board"

    Your app would know 4 different boards and their names.  You wouldn't have a limit, amd could always add more..

  • Thanks!

    what you said is only have a field to add boards, one field to add sails, not a "drop down list"

    and when the user add their own stuff need to use a "|" to separate each board, each sail

    example

    "please write down your boards separated with a |"

    Board130|Board115|Board100|Board80 

    Something like this?

  • I'm talking about adding things with app settings on your phone or with GE.

    In your app you can have a menu to select the different boards once they are defined

  • maybe I'm not understanding what you're saying, sorry, could you give me and example?

    maybe a I'm a bit confused but I was thinking you're saying like this:

    then save it as a string 

    <setting propertyKey="@Properties.BoardList" title="@Strings.boards">
    <settingConfig type="string???" required="true" />
    </setting>
    when get it with 
    var board_list = App.getApp().getProperty("BoardList");
    put it on array and separated by the "|"
     
    then do a for ()
    addmenuitem
    and voilá :D
  • So you have the list in your app in board_list, a string.

    Using things like find and substring, you grab each one, using the separator to split them up, 

  • but rather use ; instead of | due to problem with some chars and ; works in my settings from months

  • Here's some basic code where I hard coded the string, used a ";" as the separator. and put each name in an array so it's easy to use

            var board_list="Board130;Board115;Board100;Board80 ";
            var board_array=[];
            var nextSep=board_list.find(";");
            while(nextSep!=null) {
            	board_array.add(board_list.substring(0,nextSep));
            	board_list=board_list.substring(nextSep+1,null);
            	nextSep=board_list.find(";");
            }
            if(board_list.length()!=0) {board_array.add(board_list);}
            System.println(board_array);  

    The println shows the array, with the 4 separate strings:

    [Board130, Board115, Board100, Board80 ]

  • Hello.

    This cod doesn't work, gives error in line number 6


    Error: Unhandled Exception
    Exception: UnexpectedTypeException: Expected Number/Float/Boolean/Long/Double, given null
    Stack:

    Edit3:

    changed line 6 to

    board_list=board_list.substring(nextSep+1,20);
    now its working :D
    Thanks!