Thursday 13 January 2011

MIDlet Basics

MIDlet suite:

The basic components of any MIDlet suite are the Java Application Descriptor (JAD) file and the Java Archive (JAR) file. These two items are the MIDlet suite.

JAD file describes the MIDlet suite. The description includes the name, location, size of MIDlet and etc. It also contains some other attribute which are defined by developer. The JAD file syntax is similar to that of the java.util.Properties class found in the J2SE environment.

A MIDlet suite on a device is identified by the attribute tuple (MIDlet-Name, MIDlet-Version, MIDlet-Vendor). The JAR file will be installed from the location MIDlet-Jar-URL. The size of the download must agree with the MIDlet-Jar-Size value.

MIDlet life cycle:

Mobile devices interact with a MIDlet using their own software, which is called Application Management Software (AMS). AMS is responsible for installing and removing the MIDlet applications. A MIDlet can be in one of three states which is controlled via the MIDlet class methods, that every MIDlet extends and overrides.

A MIDlet class is an abstract class and MIDlet has its own life cycle. MIDlet lifecycle contains the following steps.


startApp()
pauseApp()
destroyApp()


AMS first create the MIDlet instance using no arg constructor. MIDlet can enter into the paused state by calling pauseApp() method. startApp() method is called by AMS to start the MIDlet. Whenever the application is ended or instance is destroyed, AMS calls destroyApp() method that means it goes to destroy stage.