站内搜索: 请输入搜索关键词
当前页面: 图书首页 > MIDP Style Guide for the Java 2 Platform, Micro Edition

MIDP Style Guide for the Java 2 Platform, Micro Edition

[ directory ] Previous Section Next Section

9.6 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 application-specified screen.

Application Developers

Strongly Recommend: graphics/bulb1_icon.gif If you must do an application-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 application-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 application-specific abstract command to the alert. For example, you would do this if you have to do an application-specific action but are content to use the MIDP implementor's label.

MIDP Implementors

Strongly Recommend: graphics/bulb1_icon.gif Provide a default command listener for alerts that have a single abstract command but no application-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.

    [ directory ] Previous Section Next Section