Name

CommandListener

Synopsis

An interface implemented by objects that want to be notified when the user activates a Command associated with a Displayable. A Displayable can have a single CommandListener, set using its setCommandListener() method.

When any Command on a Displayable is activated, its CommandListener’s commandAction() method is called. In order to allow a single listener to handle the actions associated with more than one Command, this method receives a reference to both the Command itself and the Displayable that this instance of the Command is associated with. The commandAction() method is typically invoked in the context of the thread that is responsible for managing the user interface and therefore any delay caused by this method may cause the user interface to appear to be unresponsive.

public interface CommandListener {  
// Public Instance Methods
   public abstract void commandAction(Command c, 
        Displayable d);  
}

Passed To

Alert.setCommandListener(), Displayable.setCommandListener()

Get J2ME in a Nutshell 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.