Home > Articles > Web Services > XML

  • Print
  • + Share This
Like this article? We recommend

Registering CommandListeners

As mentioned earlier, an instance of the MIDP List class (theList) implements the Displayable interface. The Displayable interface requires that a CommandListener be registered to it in order to process user input. I set the CommandListener in the constructor of RTTTLEx, as shown in Listing 5.

Listing 5 The Constructor for RTTTLEx

public RTTTLEx() {
  instance = this;
  display  = Display.getDisplay(this);
  //Create a new MIDP List
  theList  = new List("RTTTLEx Ring Tones",
  //Traverse the captions array and add the array's contents
  //to the list.
  for (int i = 0; i < mcaptions.length; i++) {
     theList.append(mcaptions[i], null);
  //Add Command objects to the List object
  //Register the List to be the
  //CommandListener for the application
  • + Share This
  • 🔖 Save To Your Account