var win = Ti.UI.createWindow({ title : 'AlertDialog Window', backgroundColor : 'white', exitOnClose : true, fullscreen : false }); // Create a Button. var TestDialog = Ti.UI.createButton({ title : "TestDialog", top : 400, height : Ti.UI.SIZE, width : Ti.UI.SIZE }); var dialog = Ti.UI.createAlertDialog({ buttonNames : ['Confirm', 'Cancel', 'Help'], message : 'Would you like to delete the file?', title : 'Delete' }); dialog.addEventListener("click", function(e) { if (e.index === 0) { alert("You Click Confirm"); } else if (e.index === 1) { alert("You Click Cancel"); } else if (e.index) { alert("You Click Help"); } }); // Listen for click events. TestDialog.addEventListener('click', function() { dialog.show(); }); // Add to the parent view. win.add(TestDialog); win.open();