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.

The properties defined in Action are also applicable to this action.

ToastMessage Properties

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

Animated

If true, the message has an animated effect. For iOS devices, the default value is False. For Android devices, this property is ignored. The toast for Android always has an animated effect.

  • type: boolean

Duration

Number of seconds that the message is shown.

  • type: integer
  • default: 2

Icon

File path to the location of the image that appears as an icon in the message. Default image is a check-mark. For Android devices, this property is ignored.


IsIconHidden

If True, the icon is hidden. For Android devices, this property is ignored.

  • type: boolean
  • default: false

Message

Text that conveys the message.

  • type: string

NumberOfLines

Number of lines of the message text that is shown.

  • type: integer
  • default: 1

Style

The string value is a style class name for Icon. The style is applicable to SAP icon / font icon types (Supported CSS properties are font-size and color).

  • type: string

_Type

  • type: const

The value of this property must be equal to:

"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;
}