Command Listeners for Alerts

All alerts must have a command listener. The command listener is the object that receives the notification that the alert has timed out (if the alert is timed) or that the user has chosen an abstract command associated with the alert (if the alert is modal). At least one of the commands that the command listener handles must dismiss the alert. To dismiss the alert means to change the current screen from the alert to the next app-specified screen.

app Developers

Strongly Recommend: Java graphics bulb1_icon.gif If you must do an app-specific task as the result of dismissing an alert, or if you provide multiple abstract commands, provide a command listener. The command listener must do the app-specific task then set the next screen (the screen that takes the place of the alert).

Consider: You can provide a command listener whether or not you attach an app-specific abstract command to the alert. For example, you would do this if you have to do an app-specific action but are content to use the MIDP implementor's label.

MIDP Implementors

Strongly Recommend: Java graphics bulb1_icon.gif Provide a default command listener for alerts that have a single abstract command but no app-specific command listener. The command listener must advance the MIDlet to the next screen when the user dismisses the alert or the alert times out.

Screenshot


   
Comments