2
MIDLET LIFECYCLE MIDlet application is an applet that runs in small devices. Like an applet the midlet has a life cycle. The core package which addresses the midlet life cycle is javax.microedition.midlet. Each state of life cycle is notified to Application Management Software(AMS) and the AMS acts appropriately. AMS is the device software that handles the midlet lifecycle. AMS interacts with the MIDlet application in loading and unloading the MIDlet using the MIDlet's life cycle methods and thus affecting the following midlet states. Paused State Active State Destroyed State MIDlet class is an Abstract class and your application's root class must extend this class and override its abstract methods. This can be better explained with the help of this diagram:- Active State:- Midlet's startApp() method is called to change the paused state to active state. Here the midlet is displayed on Electronic Data Interface(EDI) screen of the mobile phone. The midlet is ready to react to any user interaction as the midlet implements Command Listener Interface.

Midlet Lifecycle

Embed Size (px)

DESCRIPTION

Midlet Lifecycle

Citation preview

Page 1: Midlet Lifecycle

MIDLET LIFECYCLE

MIDlet application is an applet that runs in small devices. Like an applet the midlet has a life

cycle. The core package which addresses the midlet life cycle is javax.microedition.midlet. Each

state of life cycle is notified to Application Management Software(AMS) and the AMS acts

appropriately. AMS is the device software that handles the midlet lifecycle.

AMS interacts with the MIDlet application in loading and unloading the MIDlet using the

MIDlet's life cycle methods and thus affecting the following midlet states.

Paused State

Active State

Destroyed State

MIDlet class is an Abstract class and your application's root class must extend this class and

override its abstract methods. This can be better explained with the help of this diagram:-

Active State:- Midlet's startApp() method is called to change the paused state to active state.

Here the midlet is displayed on Electronic Data Interface(EDI) screen of the mobile phone. The

midlet is ready to react to any user interaction as the midlet implements Command Listener

Interface.

Page 2: Midlet Lifecycle

Paused State:- When MIDlet's pauseApp() is called. The MIDlet frees as much resources as it

can. startApp() can be called after paused state and the application becomes active again.

Destroyed State:- MIDlet.destroyApp() is used to do cleaning up before the application exits.

Explanation of the Above Figure:-

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.

Next, MIDlet move into Active state after application manager calling startApp() method

which implement with extend MIDlet class.

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.

The MIDlet also place itself into Paused state by calling calling notifyPaused() mehod.

The application manager puts MIDlet form Paused state to Active state by calling

startApp() Method.

One addition method resumeRequest() method calling by application manger to put

MIDlet into Active state from Paused state.

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.

A MIDlet can destroy itself by calling notifyDestroyed() method.