Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked September 29th 2010 by Karthikeyan Chandran
  • android
  • picker
  • spinner
0 Comments

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.

    — answered September 29th 2010 by Filip Dimitrovski
    permalink
    0 Comments
  • 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.

    — answered September 29th 2010 by Kevin Whinnery
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.