MIDP applications are represented by instances of the javax.microedition.midlet.MIDlet class. MIDlets have a specific life cycle, which is reflected in the methods and behavior of the MIDlet class. A piece of device-specific software, the application manager, controls the installation, execution, and life cycle of MIDlets. MIDlets have no access to the application manager. A MIDlet is installed by moving its class files to a device. 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.
A MIDlet goes through the following states:
A MIDlet goes through the following states:
1. When the MIDlet is about to be run, an instance is created. The MIDlet’s constructor is run, and the MIDlet is in the Paused state.
2. Next, the MIDlet enters the Active state after the application manager calls startApp().
3. While the MIDlet is Active, the application manager can suspend its execution by calling pauseApp(). This puts the MIDlet back in the Paused state. A MIDlet can place itself in the Paused state by calling notifyPaused().
4. While the MIDlet is in the Paused state, the application manager can call startApp() to put it back into the Active state.
5. The application manager can terminate the execution of the MIDlet by calling destroyApp(), at which point the MIDlet is destroyed and patiently awaits garbage collection. A MIDlet can destroy itself by calling notifyDestroyed().
2. Next, the MIDlet enters the Active state after the application manager calls startApp().
3. While the MIDlet is Active, the application manager can suspend its execution by calling pauseApp(). This puts the MIDlet back in the Paused state. A MIDlet can place itself in the Paused state by calling notifyPaused().
4. While the MIDlet is in the Paused state, the application manager can call startApp() to put it back into the Active state.
5. The application manager can terminate the execution of the MIDlet by calling destroyApp(), at which point the MIDlet is destroyed and patiently awaits garbage collection. A MIDlet can destroy itself by calling notifyDestroyed().
MIDlet Life Cycle
Sumber: Beginning J2ME: From Novice to Professional, Third Edition
No comments:
Post a Comment