Spinner or Picker for android in titanium
How to use the Spinner or equivalent control picker in android app?
I use the following code:
var picker = Ti.UI.createPicker();
var data = [];
data[0]=Ti.UI.createPickerRow({title:'Bananas',custom_item:'b'});
data[1]=Ti.UI.createPickerRow({title:'Strawberries',custom_item:'s'});
data[2]=Ti.UI.createPickerRow({title:'Mangos',custom_item:'m'});
data[3]=Ti.UI.createPickerRow({title:'Grapes',custom_item:'g'});
picker.add(data);
but it generate error, cannot call the method 'add' with null.
Any one give solution please?
2 Answers
-
There is no Picker in Titanium now :(
But you can use OptionDialog , or create a table and when a user clicks row , it selects it.
-
This component is also upcoming in the 1.5.0 release - if you grab a nightly build you might be able to use it right away, otherwise I would go with Filip's suggestion.