Chapter 4. Working with MIDlets
MIDlets are very simple to implement. All MIDlets
must extend the
javax.microedition.midlet.MIDlet
abstract class and implement certain methods in that class. The
MIDlet abstract class provides the basic
functionality required in all MIDlets. A MIDlet runs in a controlled
environment and therefore must implement certain methods that allow
the application manager (which installs and runs
the MIDlet) to control the behavior of the MIDlet. These methods are
known as life cycle methods, since they reflect
various states in which a MIDlet can be.
You’ll recall from the previous chapter that a MIDlet can be in one of three states: paused, active, or destroyed. The state chart in Figure 4-1 shows the possible state transitions of a MIDlet, this time with the addition of the methods that the Java Manager will call inside the MIDlet code during those transitions.

Figure 4-1. MIDlet state transitions
Here, the javax.microedition.midlet.MIDlet
abstract class defines three
life cycle methods that are
called during the state transitions: pauseApp(),
startApp(), and destroyApp().
These three methods were present in the example we developed in Chapter 1. The responsibilities for these three life
cycle methods are as follows.
-
public void startApp( ) This method indicates that the MIDlet is moving from a paused state to an active state. Here, the MIDlet will typically ...