Some time we need to have option dialog to show the options to user allowing to chose one. Using titanium, code for option box is described below.
//Define the option box var optionBox = Titanium.UI.createOptionDialog({ title : 'Choose Language Type', options : ['C#','VB', 'Cancel'], //Different options cancel : 2 //Index of the option that will cancel the dialog box }); optionBox.addEventListener('click', function(e){ //Holds the selected button index info var optionIndex = e.index; // 0 => C#, 1 => VB and 2 => Cancel //Using selected option index do the required job }); //Define button var choseBtn = Ti.UI.createButton({ title : 'Chose Language' }); //Onclick of the button show the dialog choseBtn.addEventListener('click', function(){ //Show the option dialog optionBox.show(); });