Java Programing laungage

J2ME Projects

J2ME Project 1

MIDlet Life Cycle
Previous Home Next

A MIDlet is a MID Profile and application must extend MIDlet for implement three main abstract methods and methods functionality in it, Methods are :

  1. startApp();
  2. pauseApp();
  3. destroyApp();

A MIDlet application is represented by the instance of the javax.microedition.midlet.MIDlet class. MIDlet have very specific lifecycle which is reflect in the methods and behavior of the MIDlet class. The application must extend this class to allow the application management (a piece of device- specific software) to controls the installation, execution, life cycle of MIDlet and to be able to retrieve properties from the application descriptor and notify and request state changes. The class files will be packaged in a Java Archive (JAR), while an accompanying descriptor file (with a .jad extension) describes the contents of the JAR.

Stages of MIDlet's lifecycle:

  1. When the MIDlet is about to be run, an instance of javax.microedition.midlet.MIDlet class is create. The MIDlet's class constructor is run, and the MIDlet is in the Paused state.
  2. Next, MIDlet move into Active state after application manager calling startApp() method which implement with extend MIDlet class.
  3. While the MIDlet is Active state, the application manager can suspend its execution by calling pauseApp() method. This will puts MIDlet back into Paused State.
  4. The MIDlet also place itself into Paused state by calling calling notifyPaused() mehod.
  5. The application manager puts MIDlet form Paused state to Active state by calling startApp() Method.
  6. One addition method resumeRequest() method calling by application manger to put MIDlet into Active state from Paused state.
  7. After application manager execute startApp() method, can terminate the execution by calling destroyApp() method. At that point the MIDlet is destroyed and patiently awaits garbage collection.
  8. A MIDlet can destroy itself by calling notifyDestroyed() method.
Previous Home Next