Titanium.UI.AlertDialog
> Titanium.UI.AlertDialog

An alert dialog is a modal view that includes an optional title, a message and buttons, positioned in the middle of the display.

AndroidiOSWindows Phone

An alert dialog is created using Titanium.UI.createAlertDialog or <AlertDialog> Alloy element.

Although this dialog always appears in the middle of the display (not touching the edges), other aspects of its aesthetics and the way the user interacts with it are different for each platform, as described below.

Android

On Android, the default alert dialog displays text information, via a title and message, without any buttons. As the user can use the system hardware back button to dismiss it, a button is optional.

Buttons are shown if the buttonNames property is defined, and are rendered horizontally below the message.

To create a custom layout, a view may be added and, in turn, a hierarchy of views added to that child view.

iOS

On iOS, the default alert dialog displays text information, via a title and message, with a single button to allow it to be dismissed.

Buttons are defined using the buttonNames property and are rendered vertically below the message. Alert dialogs are automatically cancelled when the application is paused/suspended. This behavior can avoided by setting persistent property on alert dialog to be true.

The style property can be used to allow the user to enter plain text, obscured text or login identifier and password. Entered values can be captured with listening cancel event.

Starting at Titanium SDK 5.1.0, you can also specify the placeholder, keyboardType and returnKeyType properties when using the alert dialog style Titanium.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT or Titanium.UI.iOS.AlertDialogStyle.SECURE_TEXT_INPUT. When using the alert dialog style Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT, you can specify the loginPlaceholder, loginKeyboardType and loginReturnKeyType properties for the login field, as well as the passwordPlaceholder, passwordKeyboardType and passwordReturnKeyType properties for the password field.

Global Alias

A global method alert() is aliased to this object, and can be invoked with a single message. For example

alert('this is a message');

This will generate an alert with a title of "Alert" and an "OK" button.

Caveats

Multiple alerts should not be shown at once.

The title and ok properties cannot be changed while the alert dialog is being displayed. On Android only, you can change the message property while the alert dialog is being displayed.

Examples

Single-button Alert Dialog (using alias)

Create a single-button alert dialog using the global alert() alias.

Ti.UI.setBackgroundColor('white');
var win = Ti.UI.createWindow({
  title: 'Click window to test',
  backgroundColor: 'white',
  exitOnClose: true,
  fullscreen: false
});

win.addEventListener('click', function(e) {
  alert('The file has been deleted');
});
win.open();

Single-button Alert Dialog (standard)

Create a single-button alert dialog, without explicitly defining it using the buttonNames property, which is invoked when the app window is clicked.

Ti.UI.setBackgroundColor('white');
var win = Ti.UI.createWindow({
  title: 'Click window to test',
  backgroundColor: 'white',
exitOnClose: true,
fullscreen: false
});

win.addEventListener('click', function(e) {
  var dialog = Ti.UI.createAlertDialog({
    message: 'The file has been deleted',
    ok: 'Okay',
    title: 'File Deleted'
  });
  dialog.show();
});
win.open();

Three-button Alert Dialog

Create a three-button alert dialog, which is invoked when the app window is clicked. Output a message to the log when the cancel button is clicked.

Ti.UI.setBackgroundColor('white');
var win = Ti.UI.createWindow({
  title: 'Click window to test',
  backgroundColor: 'white',
  exitOnClose: true,
  fullscreen: false
});
win.addEventListener('click', function(e) {
  var dialog = Ti.UI.createAlertDialog({
    cancel: 1,
    buttonNames: ['Confirm', 'Cancel', 'Help'],
    message: 'Would you like to delete the file?',
    title: 'Delete'
  });
  dialog.addEventListener('click', function(e) {
    if (e.index === e.source.cancel) {
      Ti.API.info('The cancel button was clicked');
    }
    Ti.API.info('e.cancel: ' + e.cancel);
    Ti.API.info('e.source.cancel: ' + e.source.cancel);
    Ti.API.info('e.index: ' + e.index);
  });
  dialog.show();
});
win.open();

Alert Dialog with Plain Text Input (iOS 5 and later)

Create an alert dialog and allow the user enter plain text, which is invoked when the app window is clicked. Output entered text value to the log when the OK button is clicked.

Ti.UI.setBackgroundColor('white');
var win = Ti.UI.createWindow({
  title: 'Click window to test'
});
win.addEventListener('click', function(e) {
  var dialog = Ti.UI.createAlertDialog({
    title: 'Enter text',
    style: Ti.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT,
    buttonNames: ['OK']
  });
  dialog.addEventListener('click', function(e) {
    Ti.API.info('e.text: ' + e.text);
  });
  dialog.show();
});
win.open();

Alloy XML Markup

Previous three-button alert dialog example as an Alloy view.

alertdialog.xml:

<Alloy>
    <Window id="win" onClick="showDialog" title="Click window to test" backgroundColor="white"
        exitOnClose="true" fullscreen="false" >

        <AlertDialog id="dialog" onClick="doClick" title="Delete"
            message="Would you like to delete the file?" cancel="1">

            <!-- The ButtonNames tag sets the buttonNames property. -->
            <ButtonNames>
                <ButtonName>Confirm</ButtonName>
                <ButtonName>Cancel</ButtonName>
                <ButtonName>Help</ButtonName>
            </ButtonNames>
        </AlertDialog>
    </Window>
</Alloy>

alertdialog.js:

function showDialog() {
    $.dialog.show();
}

function doClick(e) {
    Ti.API.info('e.text: ' + e.text);
}
  • 0.8
  • 0.8
  • 0.8
Defined By

Properties

Titanium.UI.AlertDialog
androidView : Titanium.UI.ViewCreation-Only

View to load inside the message area, to create a custom layout.

View to load inside the message area, to create a custom layout.

In an Alloy application you can specify this property with either an <AndroidView/> or <View/> element inside the <AlertDialog/> element, for example:

<Alloy>
    <AlertDialog onClick="doClick" title="Delete"
        message="Would you like to delete the file?" cancel="1">

        <!--  Add View or AndroidView for the androidView property  -->
        <View platform="android">
            <Label color="red" text="Warning!  This change is permanent and you cannot undo it!" />
        </View>

        <ButtonNames>
            <ButtonName>Confirm</ButtonName>
            <ButtonName>Cancel</ButtonName>
        </ButtonNames>
    </AlertDialog>
</Alloy>
  • 0.8
apiName : Stringreadonly

The name of the API that this proxy corresponds to.

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Button returns Ti.UI.Button.

  • 3.2.0
  • 3.2.0
  • 3.2.0
Indicates if the proxy will bubble an event to its parent. ...

Indicates if the proxy will bubble an event to its parent.

Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.

Default: true

  • 3.0.0
  • 3.0.0
  • 3.0.0
Titanium.UI.AlertDialog
: String[]Creation-Only
Name of each button to create. ...

Name of each button to create.

On iOS, a button will automatically be created if none are explicitly defined, because without it users would be unable to dismiss the dialog. Conversely, a dialog with no buttons may be created on Android, as the hardware back button may be used instead.

A maximum of 3 buttons is supported on Android.

Alloy applications can specify this property with a <ButtonNames> element containing one or more <ButtonName> elements (see example).

<Alloy>
    <AlertDialog id="dialog" onClick="doClick" title="Decide!" message="Do you really want to do that?" cancel="1">
        <ButtonNames>
            <ButtonName>Confirm</ButtonName>
            <ButtonName>Cancel</ButtonName>
            <ButtonName>Help</ButtonName>
        </ButtonNames>
    </AlertDialog>
</Alloy>

Default: No buttons (Android), Single "OK" button (iOS)

Titanium.UI.AlertDialog
: Number
Index to define the cancel button. ...

Index to define the cancel button.

On iOS, set to -1 to disable the cancel option.

Default: undefined (Android), -1 (iOS)

Titanium.UI.AlertDialog
: Boolean
When this is set to true, the dialog is canceled when touched outside the window's bounds. ...

When this is set to true, the dialog is canceled when touched outside the window's bounds.

Default: true on Android

  • 6.0.0
Titanium.UI.AlertDialog
: Number
Index to define the destructive button. ...

Index to define the destructive button.

Requires: iOS 8.0 and later

Note that this property is only available on iOS 8 or above. Setting to -1 disables this option.

Default: -1

  • 3.5.0
  • 3.5.0
Base elevation of the view relative to its parent in pixels. ...

Base elevation of the view relative to its parent in pixels.

Requires: Android 5 and later

The elevation of a view determines the appearance of its shadow. Higher elevations produce larger and softer shadows.

Note: The elevation property only works on Titanium.UI.View objects. Many Android components have a default elevation that cannot be modified. For more information, see Google design guidelines: Elevation and shadows.

  • 5.0.0
Sets the behavior when hiding an object to release or keep the free space ...

Sets the behavior when hiding an object to release or keep the free space

If setting hiddenBehavior to Titanium.UI.HIDDEN_BEHAVIOR_GONE it will automatically release the space the view occupied. For example: in a vertical layout the views below the object will move up when you hide an object with hiddenBehavior:Titanium.UI.HIDDEN_BEHAVIOR_GONE.

This API can be assigned the following constants:

Default: Titanium.UI.HIDDEN_BEHAVIOR_INVISIBLE

  • 6.1.0
Titanium.UI.AlertDialog
hintText : String

Hint text of the text field inside the dialog.

Hint text of the text field inside the dialog.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT or Titanium.UI.iOS.AlertDialogStyle.SECURE_TEXT_INPUT.

  • 5.4.0
  • 5.4.0
Titanium.UI.AlertDialog
hinttextid : String

Key identifying a string from the locale file to use for the hintText property.

Key identifying a string from the locale file to use for the hintText property.

Only one of hintText or hinttextid should be specified.

  • 6.2.0
  • 6.2.0
Titanium.UI.AlertDialog
: Number
Keyboard appearance to be displayed when the text field inside the dialog is focused. ...

Keyboard appearance to be displayed when the text field inside the dialog is focused.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT or Titanium.UI.iOS.AlertDialogStyle.SECURE_TEXT_INPUT.

This API can be assigned the following constants:

Default: Titanium.UI.KEYBOARD_APPEARANCE_DEFAULT

  • 5.2.0
  • 5.2.0
Titanium.UI.AlertDialog
: Number

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.

  • 3.6.0
Titanium.UI.AlertDialog
loginHintText : String

Hint text of the login text field inside the dialog.

Hint text of the login text field inside the dialog.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT.

  • 5.4.0
  • 5.4.0
Titanium.UI.AlertDialog
: Stringdeprecated
Placeholder of the login text field inside the dialog. ...

Placeholder of the login text field inside the dialog.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.loginHintText> instead.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT.

  • 5.1.0
  • 5.1.0
Titanium.UI.AlertDialog
: Number
Specifies the text to display on the keyboard Return key when this field is focused. ...
Titanium.UI.AlertDialog
loginValue : String

Value of the login text field inside the dialog.

Value of the login text field inside the dialog.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT.

  • 6.1.0
  • 6.1.0
Titanium.UI.AlertDialog
loginhinttextid : String

Key identifying a string from the locale file to use for the loginHintText property.

Key identifying a string from the locale file to use for the loginHintText property.

Only one of loginHintText or loginhinttextid should be specified.

  • 6.2.0
  • 6.2.0
Titanium.UI.AlertDialog
message : String

Dialog message.

Dialog message.

Titanium.UI.AlertDialog
messageid : String

Key identifying a string in the locale file to use for the message text.

Key identifying a string in the locale file to use for the message text.

Titanium.UI.AlertDialog
ok : String

Text for the OK button.

Text for the OK button.

This property is useful when only one button is required, as it negates the need to define the buttonNames property. If buttonNames is defined, this property is ignored.

Titanium.UI.AlertDialog
okid : String

Key identifying a string in the locale file to use for the ok text.

Key identifying a string in the locale file to use for the ok text.

If buttonNames is defined, this property is ignored.

  • 0.8
  • 0.8
Titanium.UI.AlertDialog
passwordHintText : String

Hint text of the password text field inside the dialog.

Hint text of the password text field inside the dialog.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT.

  • 5.4.0
  • 5.4.0
Titanium.UI.AlertDialog
: Stringdeprecated
Placeholder of the password text field inside the dialog. ...

Placeholder of the password text field inside the dialog.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.passwordHintText> instead.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT.

  • 5.1.0
  • 5.1.0
Titanium.UI.AlertDialog
: Number
Specifies the text to display on the keyboard Return key when this field is focused. ...
Titanium.UI.AlertDialog
passwordValue : String

Value of the password text field inside the dialog.

Value of the password text field inside the dialog.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT.

  • 6.1.0
  • 6.1.0
Titanium.UI.AlertDialog
passwordhinttextid : String

Key identifying a string from the locale file to use for the passwordHintText property.

Key identifying a string from the locale file to use for the passwordHintText property.

Only one of passwordHintText or hinttextid should be specified.

  • 6.2.0
  • 6.2.0
Titanium.UI.AlertDialog
: Boolean
Boolean value indicating if the alert dialog should only be cancelled by user gesture or by hide method. ...

Boolean value indicating if the alert dialog should only be cancelled by user gesture or by hide method.

This property is useful to ensure that the alert dialog will not be ignored by the user when the application is paused/suspended.

Default: false on iOS, true on Android

  • 3.0.0
  • 3.0.0
  • 3.0.0
Titanium.UI.AlertDialog
: Stringdeprecated
Placeholder of the text field inside the dialog. ...

Placeholder of the text field inside the dialog.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.hintText> instead.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT or Titanium.UI.iOS.AlertDialogStyle.SECURE_TEXT_INPUT.

  • 5.1.0
  • 5.1.0
Titanium.UI.AlertDialog
: Number
Index to define the preferred button. ...

Index to define the preferred button.

Requires: iOS 9.0 and later

When you specify a preferred action, the alert dialog highlights the text of that action to give it emphasis. (If the alert also contains a cancel button, the preferred action receives the highlighting instead of the cancel button.) If the iOS device is connected to a physical keyboard, pressing the Return key triggers the preferred action.

Note that this property is only available on iOS 9 or above.

Default: -1

  • 6.0.0
  • 6.0.0
The preview context used in the 3D-Touch feature "Peek and Pop". ...

The preview context used in the 3D-Touch feature "Peek and Pop".

Requires: iOS 9.0 and later

Preview context to present the "Peek and Pop" of a view. Use an configured instance of Titanium.UI.iOS.PreviewContext here.

Note: This property can only be used on devices running iOS9 or later and supporting 3D-Touch. It is ignored on older devices and can manually be checked using Titanium.UI.iOS.forceTouchSupported.

  • 5.1.0
Titanium.UI.AlertDialog
: Number
Specifies the text to display on the keyboard Return key when this field is focused. ...

Clockwise 2D rotation of the view in degrees.

Clockwise 2D rotation of the view in degrees.

Translation values are applied to the static post layout value.

  • 5.4.0

Clockwise rotation of the view in degrees (x-axis).

Clockwise rotation of the view in degrees (x-axis).

Translation values are applied to the static post layout value.

  • 5.4.0

Clockwise rotation of the view in degrees (y-axis).

Clockwise rotation of the view in degrees (y-axis).

Translation values are applied to the static post layout value.

  • 5.4.0

Scaling of the view in x-axis in pixels.

Scaling of the view in x-axis in pixels.

Translation values are applied to the static post layout value.

  • 5.4.0

Scaling of the view in y-axis in pixels.

Scaling of the view in y-axis in pixels.

Translation values are applied to the static post layout value.

  • 5.4.0
Titanium.UI.AlertDialog
: Number
The style for the alert dialog. ...

The style for the alert dialog.

Style of the alert dialog, specified using one of the constants from Titanium.UI.iOS.AlertDialogStyle. Using styles other than default one can break your dialog layout if more than two buttons used. All styles can handle up to two buttons comfortably, except for default style can handle up to six buttons when title and message is empty or not given. Note that this property is only available on iOS SDK 5 or above.

Default: Titanium.UI.iOS.AlertDialogStyle.DEFAULT

  • 3.0.0
  • 3.0.0
Titanium.UI.AlertDialog
: String
The tint-color of the dialog. ...

The tint-color of the dialog.

Requires: iOS 8.0 and later

This property is a direct correspondant of the tintColor property of UIView on iOS. For a dialog, it will tint the color of it's buttons.

Default:

  • 6.2.0
  • 6.2.0

Overrides: Titanium.UI.View.tintColor

Titanium.UI.AlertDialog
title : String

Title of the dialog.

Title of the dialog.

If not set, a dialog with no title bar will be created.

Titanium.UI.AlertDialog
titleid : String

Key identifying a string in the locale file to use for the title text.

Key identifying a string in the locale file to use for the title text.

A material design visual construct that provides an instantaneous visual confirmation of touch point. ...

A material design visual construct that provides an instantaneous visual confirmation of touch point.

Requires: Android 5.0 and later

This is an opt-in feature available from Android Lollipop. Touch feedback is applied only if the backgroundColor is a solid color.

Default: false

  • 6.1.0
Optional touch feedback ripple color. ...

Optional touch feedback ripple color. This has no effect unless touchFeedback is true.

Requires: Android 5.0 and later

Default: Theme provided color.

  • 6.1.0
A name to identify this view in activity transition. ...

A name to identify this view in activity transition.

Requires: Android 5 and later

Name should be unique in the View hierarchy.

  • 5.0.2

Horizontal location of the view relative to its left position in pixels.

Horizontal location of the view relative to its left position in pixels.

Translation values are applied to the static post layout value.

  • 5.0.0

Vertical location of the view relative to its top position in pixels.

Vertical location of the view relative to its top position in pixels.

Translation values are applied to the static post layout value.

  • 5.0.0
Depth of the view relative to its elevation in pixels. ...

Depth of the view relative to its elevation in pixels.

Requires: Android 5 and later

Translation values are applied to the static post layout value.

  • 5.0.0
Titanium.UI.AlertDialog
value : String

Value of the text field inside the dialog.

Value of the text field inside the dialog.

Note that this property is only available if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT or Titanium.UI.iOS.AlertDialogStyle.SECURE_TEXT_INPUT.

  • 6.1.0
  • 6.1.0
Defined By

Methods

Adds the specified callback as an event listener for the named event. ...

Adds the specified callback as an event listener for the named event.

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to invoke when the event is fired.

Returns

  • void
Applies the properties to the proxy. ...

Applies the properties to the proxy.

Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Parameters

  • props : Dictionary

    A dictionary of properties to apply.

Returns

  • void
Finishes a batch update of the View's layout properties and schedules a layout pass of the view tree. ...

Finishes a batch update of the View's layout properties and schedules a layout pass of the view tree.

deprecated since 3.0.0

Use the <Titanium.Proxy.applyProperties> method to batch-update layout properties.

Since the layout pass scheduled is asynchronous, the rect and size values may not be available immediately after finishLayout is called.

To be notified when the layout pass completes, add a listener for the postlayout event.

  • 2.0.0
  • 2.0.0
  • 2.0.0

Returns

  • void
Fires a synthesized event to any registered listeners. ...

Fires a synthesized event to any registered listeners.

Parameters

  • name : String

    Name of the event.

  • event : Dictionary

    A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Returns

  • void
Gets the value of the apiName property. ...

Gets the value of the apiName property.

  • 3.2.0
  • 3.2.0
  • 3.2.0

Returns

  • String
Gets the value of the bubbleParent property. ...

Gets the value of the bubbleParent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Returns

  • Boolean
Titanium.UI.AlertDialog
( ) : String[]
Gets the value of the buttonNames property. ...

Gets the value of the buttonNames property.

Returns

  • String[]
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the cancel property. ...

Gets the value of the cancel property.

Returns

  • Number
Titanium.UI.AlertDialog
( ) : Boolean
Gets the value of the canceledOnTouchOutside property. ...

Gets the value of the canceledOnTouchOutside property.

  • 6.0.0

Returns

  • Boolean
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the destructive property. ...

Gets the value of the destructive property.

  • 3.5.0
  • 3.5.0

Returns

  • Number
Gets the value of the elevation property. ...

Gets the value of the elevation property.

  • 5.0.0

Returns

  • Number
Gets the value of the hiddenBehavior property. ...

Gets the value of the hiddenBehavior property.

  • 6.1.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : String
Gets the value of the hintText property. ...

Gets the value of the hintText property.

  • 5.4.0
  • 5.4.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the hinttextid property. ...

Gets the value of the hinttextid property.

  • 6.2.0
  • 6.2.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the keyboardAppearance property. ...

Gets the value of the keyboardAppearance property.

  • 5.2.0
  • 5.2.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the keyboardType property. ...

Gets the value of the keyboardType property.

  • 5.1.0
  • 5.1.0

Returns

  • Number
Gets the value of the lifecycleContainer property. ...

Gets the value of the lifecycleContainer property.

  • 3.6.0

Returns

Titanium.UI.AlertDialog
( ) : String
Gets the value of the loginHintText property. ...

Gets the value of the loginHintText property.

  • 5.4.0
  • 5.4.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the loginKeyboardType property. ...

Gets the value of the loginKeyboardType property.

  • 5.1.0
  • 5.1.0
  • 5.1.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : Stringdeprecated
Gets the value of the loginPlaceholder property. ...

Gets the value of the loginPlaceholder property.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.loginHintText> instead.

  • 5.1.0
  • 5.1.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the loginReturnKeyType property. ...

Gets the value of the loginReturnKeyType property.

  • 5.1.0
  • 5.1.0
  • 5.1.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : String
Gets the value of the loginValue property. ...

Gets the value of the loginValue property.

  • 6.1.0
  • 6.1.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the loginhinttextid property. ...

Gets the value of the loginhinttextid property.

  • 6.2.0
  • 6.2.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the message property. ...

Gets the value of the message property.

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the messageid property. ...

Gets the value of the messageid property.

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the ok property. ...

Gets the value of the ok property.

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the okid property. ...

Gets the value of the okid property.

  • 0.8
  • 0.8

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the passwordHintText property. ...

Gets the value of the passwordHintText property.

  • 5.4.0
  • 5.4.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the passwordKeyboardType property. ...

Gets the value of the passwordKeyboardType property.

  • 5.1.0
  • 5.1.0
  • 5.1.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : Stringdeprecated
Gets the value of the passwordPlaceholder property. ...

Gets the value of the passwordPlaceholder property.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.passwordHintText> instead.

  • 5.1.0
  • 5.1.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the passwordReturnKeyType property. ...

Gets the value of the passwordReturnKeyType property.

  • 5.1.0
  • 5.1.0
  • 5.1.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : String
Gets the value of the passwordValue property. ...

Gets the value of the passwordValue property.

  • 6.1.0
  • 6.1.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the passwordhinttextid property. ...

Gets the value of the passwordhinttextid property.

  • 6.2.0
  • 6.2.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : Boolean
Gets the value of the persistent property. ...

Gets the value of the persistent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Returns

  • Boolean
Titanium.UI.AlertDialog
( ) : Stringdeprecated
Gets the value of the placeholder property. ...

Gets the value of the placeholder property.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.hintText> instead.

  • 5.1.0
  • 5.1.0

Returns

  • String
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the preferred property. ...

Gets the value of the preferred property.

  • 6.0.0
  • 6.0.0

Returns

  • Number
Gets the value of the previewContext property. ...

Gets the value of the previewContext property.

  • 5.1.0

Returns

Titanium.UI.AlertDialog
( ) : Number
Gets the value of the returnKeyType property. ...

Gets the value of the returnKeyType property.

  • 5.1.0
  • 5.1.0

Returns

  • Number
Gets the value of the rotation property. ...

Gets the value of the rotation property.

  • 5.4.0

Returns

  • Number
Gets the value of the rotationX property. ...

Gets the value of the rotationX property.

  • 5.4.0

Returns

  • Number
Gets the value of the rotationY property. ...

Gets the value of the rotationY property.

  • 5.4.0

Returns

  • Number
Gets the value of the scaleX property. ...

Gets the value of the scaleX property.

  • 5.4.0

Returns

  • Number
Gets the value of the scaleY property. ...

Gets the value of the scaleY property.

  • 5.4.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : Number
Gets the value of the style property. ...

Gets the value of the style property.

  • 3.0.0
  • 3.0.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : String
Gets the value of the tintColor property. ...

Gets the value of the tintColor property.

  • 6.2.0
  • 6.2.0

Returns

  • String

Overrides: Titanium.UI.View.getTintColor

Titanium.UI.AlertDialog
( ) : String
Gets the value of the title property. ...

Gets the value of the title property.

Returns

  • String
Titanium.UI.AlertDialog
( ) : String
Gets the value of the titleid property. ...

Gets the value of the titleid property.

Returns

  • String
Gets the value of the touchFeedback property. ...

Gets the value of the touchFeedback property.

  • 6.1.0

Returns

  • Boolean
Gets the value of the touchFeedbackColor property. ...

Gets the value of the touchFeedbackColor property.

  • 6.1.0

Returns

  • String
Gets the value of the transitionName property. ...

Gets the value of the transitionName property.

  • 5.0.2

Returns

  • String
Gets the value of the translationX property. ...

Gets the value of the translationX property.

  • 5.0.0

Returns

  • Number
Gets the value of the translationY property. ...

Gets the value of the translationY property.

  • 5.0.0

Returns

  • Number
Gets the value of the translationZ property. ...

Gets the value of the translationZ property.

  • 5.0.0

Returns

  • Number
Titanium.UI.AlertDialog
( ) : String
Gets the value of the value property. ...

Gets the value of the value property.

  • 6.1.0
  • 6.1.0

Returns

  • String
Returns the matching view of a given view ID. ...

Returns the matching view of a given view ID.

  • 6.1.0
  • 6.1.0
  • 6.1.0

Parameters

  • id : String

    The ID of the view that should be returned. Use the id property in your views to enable it for indexing in this method.

Returns

Titanium.UI.AlertDialog
( [options] )
Hides this dialog. ...

Hides this dialog.

  • 0.9
  • 0.9
  • 0.9

Parameters

  • options : AnimationOption (optional)

    Animation options for Android. Since Release 5.1.0.

Returns

  • void

Overrides: Titanium.UI.View.hide

Inserts a view at the specified position in the children array. ...

Inserts a view at the specified position in the children array.

Useful if the layout property is set to horizontal or vertical.

  • 3.3.0
  • 3.3.0
  • 3.3.0

Parameters

  • params : Dictionary

    Pass an object with the following key-value pairs:

    • view (Titanium.UI.View): View to insert
    • position (Number): Position in the children array to insert the view. If omitted, inserts the view to the end of the array.

Returns

  • void
Removes the specified callback as an event listener for the named event. ...

Removes the specified callback as an event listener for the named event.

Multiple listeners can be registered for the same event, so the callback parameter is used to determine which listener to remove.

When adding a listener, you must save a reference to the callback function in order to remove the listener later:

var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);

To remove the listener, pass in a reference to the callback function:

window.removeEventListener('click', listener);

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to remove. Must be the same function passed to addEventListener.

Returns

  • void
Replaces a view at the specified position in the children array. ...

Replaces a view at the specified position in the children array.

Useful if the layout property is set to horizontal or vertical.

  • 3.3.0
  • 3.3.0
  • 3.3.0

Parameters

  • params : Dictionary

    Pass an object with the following key-value pairs:

    • view (Titanium.UI.View): View to insert
    • position (Number): Position in the children array of the view elment to replace.

Returns

  • void
Sets the value of the bubbleParent property. ...

Sets the value of the bubbleParent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Parameters

  • bubbleParent : Boolean

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( buttonNames )
Sets the value of the buttonNames property. ...

Sets the value of the buttonNames property.

Parameters

  • buttonNames : Array<String>

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( cancel )
Sets the value of the cancel property. ...

Sets the value of the cancel property.

Parameters

  • cancel : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( canceledOnTouchOutside )
Sets the value of the canceledOnTouchOutside property. ...

Sets the value of the canceledOnTouchOutside property.

  • 6.0.0

Parameters

  • canceledOnTouchOutside : Boolean

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( destructive )
Sets the value of the destructive property. ...

Sets the value of the destructive property.

  • 3.5.0
  • 3.5.0

Parameters

  • destructive : Number

    New value for the property.

Returns

  • void
Sets the value of the elevation property. ...

Sets the value of the elevation property.

  • 5.0.0

Parameters

  • elevation : Number

    New value for the property.

Returns

  • void
Sets the value of the hiddenBehavior property. ...

Sets the value of the hiddenBehavior property.

  • 6.1.0

Parameters

  • hiddenBehavior : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( hintText )
Sets the value of the hintText property. ...

Sets the value of the hintText property.

  • 5.4.0
  • 5.4.0

Parameters

  • hintText : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( hinttextid )
Sets the value of the hinttextid property. ...

Sets the value of the hinttextid property.

  • 6.2.0
  • 6.2.0

Parameters

  • hinttextid : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( keyboardAppearance )
Sets the value of the keyboardAppearance property. ...

Sets the value of the keyboardAppearance property.

  • 5.2.0
  • 5.2.0

Parameters

  • keyboardAppearance : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( keyboardType )
Sets the value of the keyboardType property. ...

Sets the value of the keyboardType property.

  • 5.1.0
  • 5.1.0

Parameters

  • keyboardType : Number

    New value for the property.

Returns

  • void
Sets the value of the lifecycleContainer property. ...

Sets the value of the lifecycleContainer property.

  • 3.6.0

Parameters

Returns

  • void
Titanium.UI.AlertDialog
( loginHintText )
Sets the value of the loginHintText property. ...

Sets the value of the loginHintText property.

  • 5.4.0
  • 5.4.0

Parameters

  • loginHintText : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( loginKeyboardType )
Sets the value of the loginKeyboardType property. ...

Sets the value of the loginKeyboardType property.

  • 5.1.0
  • 5.1.0
  • 5.1.0

Parameters

  • loginKeyboardType : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( loginPlaceholder )deprecated
Sets the value of the loginPlaceholder property. ...

Sets the value of the loginPlaceholder property.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.loginHintText> instead.

  • 5.1.0
  • 5.1.0

Parameters

  • loginPlaceholder : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( loginReturnKeyType )
Sets the value of the loginReturnKeyType property. ...

Sets the value of the loginReturnKeyType property.

  • 5.1.0
  • 5.1.0
  • 5.1.0

Parameters

  • loginReturnKeyType : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( loginValue )
Sets the value of the loginValue property. ...

Sets the value of the loginValue property.

  • 6.1.0
  • 6.1.0

Parameters

  • loginValue : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( loginhinttextid )
Sets the value of the loginhinttextid property. ...

Sets the value of the loginhinttextid property.

  • 6.2.0
  • 6.2.0

Parameters

  • loginhinttextid : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( message )
Sets the value of the message property. ...

Sets the value of the message property.

Parameters

  • message : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( messageid )
Sets the value of the messageid property. ...

Sets the value of the messageid property.

Parameters

  • messageid : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( ok )
Sets the value of the ok property. ...

Sets the value of the ok property.

Parameters

  • ok : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( okid )
Sets the value of the okid property. ...

Sets the value of the okid property.

  • 0.8
  • 0.8

Parameters

  • okid : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( passwordHintText )
Sets the value of the passwordHintText property. ...

Sets the value of the passwordHintText property.

  • 5.4.0
  • 5.4.0

Parameters

  • passwordHintText : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( passwordKeyboardType )
Sets the value of the passwordKeyboardType property. ...

Sets the value of the passwordKeyboardType property.

  • 5.1.0
  • 5.1.0
  • 5.1.0

Parameters

  • passwordKeyboardType : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( passwordPlaceholder )deprecated
Sets the value of the passwordPlaceholder property. ...

Sets the value of the passwordPlaceholder property.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.passwordHintText> instead.

  • 5.1.0
  • 5.1.0

Parameters

  • passwordPlaceholder : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( passwordReturnKeyType )
Sets the value of the passwordReturnKeyType property. ...

Sets the value of the passwordReturnKeyType property.

  • 5.1.0
  • 5.1.0
  • 5.1.0

Parameters

  • passwordReturnKeyType : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( passwordValue )
Sets the value of the passwordValue property. ...

Sets the value of the passwordValue property.

  • 6.1.0
  • 6.1.0

Parameters

  • passwordValue : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( passwordhinttextid )
Sets the value of the passwordhinttextid property. ...

Sets the value of the passwordhinttextid property.

  • 6.2.0
  • 6.2.0

Parameters

  • passwordhinttextid : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( persistent )
Sets the value of the persistent property. ...

Sets the value of the persistent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Parameters

  • persistent : Boolean

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( placeholder )deprecated
Sets the value of the placeholder property. ...

Sets the value of the placeholder property.

deprecated since 5.4.0

Use <Titanium.UI.AlertDialog.hintText> instead.

  • 5.1.0
  • 5.1.0

Parameters

  • placeholder : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( preferred )
Sets the value of the preferred property. ...

Sets the value of the preferred property.

  • 6.0.0
  • 6.0.0

Parameters

  • preferred : Number

    New value for the property.

Returns

  • void
Sets the value of the previewContext property. ...

Sets the value of the previewContext property.

  • 5.1.0

Parameters

Returns

  • void
Titanium.UI.AlertDialog
( returnKeyType )
Sets the value of the returnKeyType property. ...

Sets the value of the returnKeyType property.

  • 5.1.0
  • 5.1.0

Parameters

  • returnKeyType : Number

    New value for the property.

Returns

  • void
Sets the value of the rotation property. ...

Sets the value of the rotation property.

  • 5.4.0

Parameters

  • rotation : Number

    New value for the property.

Returns

  • void
Sets the value of the rotationX property. ...

Sets the value of the rotationX property.

  • 5.4.0

Parameters

  • rotationX : Number

    New value for the property.

Returns

  • void
Sets the value of the rotationY property. ...

Sets the value of the rotationY property.

  • 5.4.0

Parameters

  • rotationY : Number

    New value for the property.

Returns

  • void
Sets the value of the scaleX property. ...

Sets the value of the scaleX property.

  • 5.4.0

Parameters

  • scaleX : Number

    New value for the property.

Returns

  • void
Sets the value of the scaleY property. ...

Sets the value of the scaleY property.

  • 5.4.0

Parameters

  • scaleY : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( style )
Sets the value of the style property. ...

Sets the value of the style property.

  • 3.0.0
  • 3.0.0

Parameters

  • style : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( tintColor )
Sets the value of the tintColor property. ...

Sets the value of the tintColor property.

  • 6.2.0
  • 6.2.0

Parameters

  • tintColor : String

    New value for the property.

Returns

  • void

Overrides: Titanium.UI.View.setTintColor

Titanium.UI.AlertDialog
( title )
Sets the value of the title property. ...

Sets the value of the title property.

Parameters

  • title : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( titleid )
Sets the value of the titleid property. ...

Sets the value of the titleid property.

Parameters

  • titleid : String

    New value for the property.

Returns

  • void
Sets the value of the touchFeedback property. ...

Sets the value of the touchFeedback property.

  • 6.1.0

Parameters

  • touchFeedback : Boolean

    New value for the property.

Returns

  • void
Sets the value of the touchFeedbackColor property. ...

Sets the value of the touchFeedbackColor property.

  • 6.1.0

Parameters

  • touchFeedbackColor : String

    New value for the property.

Returns

  • void
Sets the value of the transitionName property. ...

Sets the value of the transitionName property.

  • 5.0.2

Parameters

  • transitionName : String

    New value for the property.

Returns

  • void
Sets the value of the translationX property. ...

Sets the value of the translationX property.

  • 5.0.0

Parameters

  • translationX : Number

    New value for the property.

Returns

  • void
Sets the value of the translationY property. ...

Sets the value of the translationY property.

  • 5.0.0

Parameters

  • translationY : Number

    New value for the property.

Returns

  • void
Sets the value of the translationZ property. ...

Sets the value of the translationZ property.

  • 5.0.0

Parameters

  • translationZ : Number

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( value )
Sets the value of the value property. ...

Sets the value of the value property.

  • 6.1.0
  • 6.1.0

Parameters

  • value : String

    New value for the property.

Returns

  • void
Titanium.UI.AlertDialog
( [options] )
Shows this dialog. ...

Shows this dialog.

  • 0.9
  • 0.9
  • 0.9

Parameters

  • options : AnimationOption (optional)

    Animation options for Android. Since Release 5.1.0.

Returns

  • void

Overrides: Titanium.UI.View.show

Starts a batch update of this view's layout properties. ...

Starts a batch update of this view's layout properties.

deprecated since 3.0.0

Use the <Titanium.Proxy.applyProperties> method to batch-update layout properties.

To prevent a layout pass each time a property is modified, call startLayout before changing any properties that may change this view's layout. This initiates a batch update mode where layout changes are deferred.

Call finishLayout to end batch update mode and trigger a layout pass. For example:

view.startLayout();
view.top = 50;
view.left = 50;
view.finishLayout();

Note that any property changes made during the batch update may be deferred until finishLayout is called. This may vary somewhat by platform. For example, changing the text of a label may trigger a layout pass. In iOS, updating the label text is deferred.

See also: updateLayout, finishLayout, postlayout event.

  • 2.0.0
  • 2.0.0
  • 2.0.0

Returns

  • void
( params )deprecated
Performs a batch update of all supplied layout properties and schedules a layout pass after they have been updated. ...

Performs a batch update of all supplied layout properties and schedules a layout pass after they have been updated.

deprecated since 3.0.0

Use the <Titanium.Proxy.applyProperties> method to batch-update layout properties.

This is another way to perform a batch update. The updateLayout method is called with a dictionary of layout properties to perform the batch update. For example:

view.updateLayout({top:50, left:50});

This is equivalent to the following:

view.startLayout();
view.top = 50;
view.left = 50;
view.finishLayout();

See also: startLayout, finishLayout, postlayout event.

  • 2.0.0
  • 2.0.0
  • 2.0.0

Parameters

  • params : Dictionary

    Layout properties to be updated.

Returns

  • void
Defined By

Events

Titanium.UI.AlertDialog
Fired when a button in the dialog is clicked. ...

Fired when a button in the dialog is clicked.

There is a subtle difference between singletap and click events.

A singletap event is generated when the user taps the screen briefly without moving their finger. This gesture will also generate a click event.

However, a click event can also be generated when the user touches, moves their finger, and then removes it from the screen.

On Android, a click event can also be generated by a trackball click.

  • 0.9
  • 0.9
  • 0.9

Properties

  • cancel : Boolean/Number

    Boolean type on Android; Number on iOS.

    On Android, indicates whether the cancel button was clicked, in which case returns true.

    On iOS, the value of the cancel property is returned, if defined, or -1 otherwise. Also note that the cancel button may not be used on the iPad, because iOS will internally decide whether or not to show it in the current context (e.g. in a popover).

    See the Three-button Alert Dialog example for a cross-platform workaround for this parity issue.

  • index : Number

    Index of the button that was clicked.

  • login : String

    Value of login field if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT.

    •  
    •  
  • password : String

    Value of password field if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT.

    •  
    •  
  • text : String

    Value of text field if dialog style property is defined as Titanium.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT or Titanium.UI.iOS.AlertDialogStyle.SECURE_TEXT_INPUT.

    •  
    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  

Overrides: Titanium.UI.View.click