Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Developing midlets


Published on

MIDlet Lifecycle

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Developing midlets

  1. 1. Java Mobile ProgrammingAfrica Nazarene University,Meru CampusMay Trimester, 2013Raphael Wanjiku,Computer Science Department
  2. 2. Developing MidletsMidlet- A java application that can run on any MIDP device.We will develop our applications using the Sun’s J2ME Wireless Toolkit.Hello world MidletSteps1. Click on File ->New Project ->Categories(Java ME SDK) ->MIDP Application2. Name the project as HelloApp and do not deselect the checkboxes.3. Select Device(for Emulation)4. Select device configuration as CLDC-1.05. Select Device profiles as MIDP-2.0 and click finish.
  3. 3. 1. These imports the necessary classes required for use by the Midlet2. Declaration of variables to be used in the Midlet3. Creation of the constructor HelloMidlet().This is where objects are instantiated.4. Instantiation of the different classes objects.5. Implementation of the setCommandListener () method on the command object.6. Setting of the displayable object upon call of the startApp().7. Shows the class scope. This is shown by the curly braces.8. Implementation of the commandAction().This is where one specifies which commandnavigates where.Midlet LifecycleA Midlet’s lifecycle is reflected in the methods and behaviour of the MIDlet class. A MIDletgoes through the following states:a) When a MIDlet is run, the constructor is run creating an instance. It is in the pausedstate.b) The MIDlet then enters the Active state when the startApp () is called.c) While the MIDlet is still in the active state, its execution can be suspended enteringinto paused state. This is effected by calling notifyPaused ().d) While in the paused state, it can resume by calling startApp() to put it back into theactive state.e) The MIDlet can be terminated by calling the destroyApp() or auto-destroy by callingnotifyDestroyed().Code Explanation