Alert

If the Alert's content requires scrolling, the Alert becomes modal.

If the AlertType is altered with setType() method after the Alert object has been created, it does not affect the timeout.

If the text content of a modal Alert is bigger than what can be visible at one time, the text can be scrolled with the Arrow up and Arrow down keys. The graphic icon within Alert does not scroll and it is always shown on Alert.

Default Alert properties

The default Alert text, Alert icon, and label text for Alert’s dismiss operation (the DISMISS_COMMAND in MIDP 2.1) shown in the table below are used when the attribute is not explicitly set. Their presentation is based on the AlertType that is set to the Alert. For example, the label can be different when the AlertType is set as ALARM than when it is set as INFO.

The table below shows default Alert properties depending on AlertType.

Table 20: Alert properties based on AlertType

AlertType

Default Alert text

Default Alert icon

Default label text for modal Alert dismiss operation (DISMISS_COMMAND)

Default timeout length

AlertType.ERROR

Error

Error

OK

3 seconds

AlertType.WARNING

Warning

Warning

OK

3 seconds

AlertType.INFO

Information

Info

OK

3 seconds

AlertType.CONFIRMATION

OK

Confirmation

OK

1,5 seconds

AlertType.ALARM

Alarm

Alarm

OK

3 seconds

AlertType is null

Alert

No icon or image is presented. Space is made available for Alert text.

OK

3 seconds

Using Command with Alert

If there is a CommandListener set by an application, then that listener is always called when Command activation happens regardless whether there is DISMISS_COMMAND or whether there are application settable Commands and regardless whether the Alert is timed or modal.

On a timed Alert there can only be one Command, which is either the DISMISS_COMMAND or an application set Command.

If the setCommandListener has not been called there is so called "default listener" used in the Alert. The behavior of "default listener" is as follows:

  • When the listener is called the listener will automatically change the current Displayable to either previous Displayable or to a specified Displayable.

  • The previous Displayable is made current if the Alert was made current with Display's setCurrent(Displayable nextDisplayable) method.

  • The specified Displayable is made current if the application used setCurrent(Alert alert, Displayable nextDisplayable) method.

If the setCommandListener has been called then that listener is always in use even when an Alert is timed or the DISMISS_COMMAND is in use. It is up to the application to do the Displayable change when the listener is activated.

The number of application settable Commands has the following effect on an Alert:

  • If no application settable Commands are present on the Alert, the default DISMISS_COMMAND is used.

  • If there are one or more Commands set by an application then the DISMISS_COMMAND is replaced.

  • If there is only one Command and the Alert is modal then the one Command is visible normally as a softkey and the Command is activated only when the user selects it.

  • If there are two or more Commands set by an application then the Alert becomes automatically modal even if it is set as a timed Alert. A longer text, which requires scrolling, also forces a timed Alert to become modal.

  • On a timed Alert, the label of the Command is not visible in the device display. The Command is either implicitly activated (the set listener or default listener is notified) when the timer expires or explicitly activated if the user presses some other key defined to dismiss a timed Alert.

For information on Alert implementation in Touch UI -enabled devices, see section Displayables and commands.