Name

javax.microedition.lcdui.Alert

Synopsis

This class implements an alert, which is an ordinary screen that can contain text and images and that handles events like other screens. The purpose of an alert is to inform the user about errors and other exceptional conditions.

The alert screen usually waits for a certain period of time before proceeding to the next screen. Alternatively, the alert timer can be set to infinity, using setTimeout(Alert.FOREVER). In this case, the implementation allows the user to dismiss the alert.

An alert may have a type (see the AlertType class) that the implementation may use to play an appropriate sound when the alert is presented to the user. To set the alert type, use setType( ).

public classAlert extends Screen {
   // public class fields
   public static final int FOREVER = -2;
   // public constructors
   public Alert(String title);
   public Alert(String title, String alertText, Image image, AlertType alertType);
   // public instance methods
   public void addCommand(Command cmd);
   public int getDefaultTimeout(  );
   public Image getImage(  );
   public String getString(  );
   public int getTimeOut(  );
   public AlertType getType(  );
   public void setCommandListener(CommandListener l);
   public void setImage(Image image);
   public void setString(String str);
   public void setTimeout(int time);
   public void setType(AlertType type);
}

Get Wireless Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.