arquicanedo / barbecueboss

Barbecue ConnectIQ App for Garmin Devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can Pickers be initialized to a specific item?

arquicanedo opened this issue · comments

Chances are that if you're coking a food type you're doing more than one. Is there a way to initialize a picker to the last selected picker?

looks like the Picker base class has a setOptions() method. One of the parameters of that dictionary is "defaults" which is an array containing the index to be selected.

image

So you would probably just need to look up the index in the BitmapFactory that matches the enum/image type you want, and pass that in to the setOptions method of the picker before showing it.

and actually, this could be passed as options to the constructor too (initialize) so when the picker is created we can just tell it which image to select.

This worked out great. Now we have the last selected food type. Closing this one and opening a new one to replace the TimeSelectionMenu to be a picker instead of a menu.