| Platform | Since |
|---|---|
| Android | 0.8 |
| iPhone | 0.8 |
| iPad | 0.8 |
| Mobile Web | 1.8 |
The Alert Dialog is created by Titanium.UI.createAlertDialog and allows you to show a modal application dialog.
the global method alert is aliased to this object and can be invoked with a single message. For example:
alert("this is a message");
Note: you should be careful not to call alert more than once while a pending alert is visible.
On iOS 4, alert dialogs will automatically be cancelled upon application suspend.
In this example, we show a simple alert dialog.
var alertDialog = Titanium.UI.createAlertDialog({ title: 'Hello', message: 'You got mail', buttonNames: ['OK','Doh!'] }); alertDialog.show();
| Name | Summary |
|---|---|
| addEventListener |
Adds the specified callback as an event listener for the named event. |
| fireEvent |
Fires a synthesized event to any registered listeners. |
| getAndroidView |
Gets the value of the androidView property. (Android, iPhone, iPad only.) |
| getButtonNames |
Gets the value of the buttonNames property. |
| getCancel |
Gets the value of the cancel property. |
| getMessage |
Gets the value of the message property. |
| getOk |
Gets the value of the ok property. (Android, iPhone, iPad only.) |
| getTitle |
Gets the value of the title property. |
| hide |
hides the alert dialog and unblocks the background view |
| removeEventListener |
Removes the specified callback as an event listener for the named event. |
| setAndroidView |
Sets the value of the androidView property. (Android, iPhone, iPad only.) |
| setButtonNames |
Sets the value of the buttonNames property. |
| setCancel |
Sets the value of the cancel property. |
| setMessage |
Sets the value of the message property. |
| setOk |
Sets the value of the ok property. (Android, iPhone, iPad only.) |
| setTitle |
Sets the value of the title property. |
| show |
shows the alert dialog and blocks the background view like a modal window |
| Name | Type | Summary |
|---|---|---|
| androidView | Titanium.UI.View |
Titanium view that should be loaded inside the alert dialog (Android, iPhone, iPad only.) |
| buttonNames | Array<Object> |
array of button names as strings |
| cancel | Number |
an index to indicate which button should be the cancel button |
| message | String |
the message of the dialog |
| messageid | String |
the key in the locale file to use for the message property |
| ok | String |
Text for the OK button. Useful for when you only want one button and therefore don't want to use the |
| okid | String |
the key in the locale file to use for the |
| title | String |
the title of the dialog |
| titleid | String |
the key in the locale file to use for the title property (Android, iPhone, iPad only.) |
| Name | Summary |
|---|---|
| click |
fired when a button in the dialog is clicked |