Retrieving the predefined properties : MIDlet « J2ME « Java Tutorial






import java.io.IOException;
import java.io.InputStream;

import javax.microedition.midlet.MIDlet;

public class RuntimeAccessMIDlet extends MIDlet {
  public void startApp() {
    System.out.println("MIDlet-Name: " + getAppProperty("MIDlet-Name"));
    System.out.println("MIDlet-Vendor: " + getAppProperty("MIDlet-Vendor"));
    System.out.println("MIDlet-Version: " + getAppProperty("MIDlet-Version"));
    System.out.println("MIDlet-Description: " + getAppProperty("MIDlet-Description"));
    System.out.println("Target-Devices: " + getAppProperty("Target-Devices"));
    System.out.println("Display-Size: " + getAppProperty("Display-Size"));
    InputStream is = this.getClass().getResourceAsStream("/readme.txt");
    try {
      if (is != null) {
        int character;
        while ((character = is.read()) != -1) {
          System.out.print((char) character);
        }
        is.close();
      }
    } catch (IOException e) {
      System.out.println(e);
    }
  }

  public void pauseApp() {
  }

  public void destroyApp(boolean unconditional) {
  }
}








31.1.MIDlet
31.1.1.Skeleton of a MIDlet
31.1.2.list Capabilitieslist Capabilities
31.1.3.KVM Properties
31.1.4.Retrieving the predefined properties
31.1.5.extends MIDletextends MIDlet
31.1.6.detect and report MIDlet run-time environment
31.1.7.A first MIDlet with simple text and a few commandsA first MIDlet with simple text and a few commands