Ui.NumberPicker --> How to pick a simple number?

Hi

how can i use NumberPicker to pick a simple number?

NUMBER_PICKER_DISTANCE, BIRTH_YEAR and so an works fine.
np = new Ui.NumberPicker( Ui.NUMBER_PICKER_CALORIES, testVali );
Ui.pushView( np, new NPDi(), Ui.SLIDE_IMMEDIATE );

But how can i just ask the user for a number between 5 and 10?

My programm works fine with TextPicker but there you have to change to "number Mode" with is pretty annoying.


Thanks
  • The NumberPicker exposes various picker types in the underlying system, which are limited to specific kinds of numbers, like distance in meters, calories, dates, etc. We don't yet have a generic number picker, but watch for updates in an upcoming release to address this shortcoming!
  • Thank you.

    so, textpicker will be the best way asking the user for a specific number.
    Hopefully 1.1.5 or 1.2 brings new API features.
  • Thank you.

    so, textpicker will be the best way asking the user for a specific number.
    Hopefully 1.1.5 or 1.2 brings new API features.


    Something to note: The TextPicker isn't available on the vivoactive.
  • Sorry for digging out this old post, but it's been quite some time and from what I can tell as a ConnectIQ noob that is just starting out, no generic number picker has been added to the SDK, or?

    Ha, I just found another post that mentions that NumberPicker and TextPicker are deprecated, but still show up in the docs apparently as the doc generator doesn't seem to honor the deprecation tag for classes...

    Thought it also says they were tagged for removal in v3.0.0. What has happened since? Are there alternatives?

  • Since this post, the generic picker has been added.  See https://developer.garmin.com/connect-iq/api-docs/Toybox/WatchUi/Picker.html .  There's also the picker sample in the SDK

    Also, note that things like the NumberPicker don't actually get removed and will remain based on the SDK version of the target device. If you look at "Supported devices" for the NumberPicker, you'll see some devices supported but not the newer ones.

    Depending on your app, you can also use Menu2 to pick a number, where each time select is entered on the menu item, it advances one and wraps when it reaches the maximum.  I use this for colors in a watch face with on device settings as well as things like a zoom level for maps in other things.  Here's such a watch face, and you want to see it, you need to go to the watch face selector, and do a "customize"

    https://apps.garmin.com/en-US/apps/c051f37a-8fad-4907-b124-0112fe010c91

  • Thanks Jim! 
    I'm just getting started writing my own app and still getting the hang of the documentation. I find it a bit all over the place, but maybe just need to get used to it. I actually stumbled across the the generic Picker first, but thought the NumberPicker was a more specialized class that came after and hence wanted to use it instead. I've since switched my implementation to use Picker instead. Had I not tested this against a fenix 6, I would have discovered this much much later.

    Thanks also for the suggestion to use Menu2, neat idea.