Java by API/javax.microedition.midlet/MIDlet

Материал из Java эксперт
Перейти к: навигация, поиск

extends MIDlet

   
import javax.microedition.midlet.MIDlet;
public class MyMIDlet extends MIDlet {
  public MyMIDlet() {
    // constructor
  }
  public void startApp() {
    // entering active state
  }
  public void pauseApp() {
    // entering paused state
  }
  public void destroyApp() {
    // entering destroyed state
  }
}





MIDlet: getAppProperty(String key)

   
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.midlet.MIDlet;
public class Main 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) {
  }
}