Abstract Commands

Abstract commands enable app designers to define actions for a MIDlet without specifying the accompanying user interface. Instead of requiring app designers to put all actions on menus or buttons, MIDP implementors decide how to present abstract commands. Giving this responsibility to MIDP implementors makes MIDlets more portable. It also enables a MIDlet to be consistent with apps on a variety of devices, without porting any user-interface code, and it increases the usability of your app because of tighter integration with the device's native user interface. An app can have any number of abstract commands. The commands can be associated with a form item, a screen, or both. (See "Item-Specific Abstract Commands" on page 88 and "Buttons and Hyperlinks" on page 97 for information on commands associated with form items and how they can help to change the look of strings and images.) The app developer can add or remove an needed.

app Developer Responsibilities

MIDP Implementor Responsibilities

  • Text for short and long labels
  • Associated app action
  • Purpose (type) of the command
  • Importance (priority), compared to other abstract commands of the same type
  • Mapping abstract commands to the device
  • Ordering of abstract commands
  • Label display policy (clipping or wrapping, when to use short or long label, when to show label)
  • Determining how user selects an abstract commands
  • Notifying the app when the user chooses an abstract command
An abstract command has three parts: a command type, a label, and a priority. There are two kinds of labels, short and long. The short label is required; the long label is optional. The app developer creates the abstract commands and cannot update the command type, label, or priority of the instance. The app developer can add and remove the abstract commands from displayables as needed. (See Programming Wireless Devices with the Java 2 Platform, Micro version [17] for information on the Command API.)


   
Comments