Skip to content

ToastMessage

Toast messages appear as pop-ups that are automatically dismissed after a defined duration. In Mobile Development Kit, you can create toast messages and define their behavior.

Note: Failure event handlers cannot be defined for toast messages. On the other hand, you must use success event handlers while binding other actions to a toast message. Once the toast message appears, subsequent actions are executed immediately.

All the properties defined under Action are applicable to this action.

ToastMessage Properties

Property Type Required Default
Animated boolean No
Duration integer No 2
Icon Image No
IsIconHidden boolean No false
Message string Yes
NumberOfLines integer No 1
Style string No
_Type const Yes

Animated

If set to true, animation effects will be added to the message. For iOS devices, the default value is False. This parameter is not applicable for Android. By default, toast messages on Android will always be animated.

  • type: boolean

Duration

Indicates the number of seconds the toast message has to be displayed.

  • type: integer
  • default: 2

Icon

This parameter allows the users to define the path to the image file that has to be displayed as icon in the message. Default image is a check-mark. This parameter is not applicable for Android.


IsIconHidden

If set to True, the icon is hidden. This parameter is not applicable for Android.

  • type: boolean
  • default: false

Message

Text that conveys the message.

  • type: string

NumberOfLines

Number of lines to displayed from the text defined in the Message.

  • type: integer
  • default: 1

Style

A string value that defines the style class name of Icon. Style is applicable for SAP icon/font icon types (CSS properties like font-size and color are supported).

  • type: string

_Type

  • type: const

The value of this property must be:

"Action.Type.ToastMessage"

Action Result

This action has no ActionResult.


Examples

// ToastMessage.action
{
    "Message": "This is a toast message test",
    "Icon": "test.png",
    "IsIconHidden": false,
    "NumberOfLines": 2,
    "Duration": 3,
    "Animated": true,
    "_Type": "Action.Type.ToastMessage"
}

// ToastMessage.action with font icon and style example
{
    "Message": "This is a toast message test with font icon styling",
    "Icon": "test.png",
    "IsIconHidden": false,
    "NumberOfLines": 2,
    "Duration": 3,
    "Animated": true,
    "Style": "font-icon-class",
    "_Type": "Action.Type.ToastMessage"
}

Style Classes Definition

.font-icon-class {
  font-size: 4;
  color: red;
}