5
Application Management
MIDlet Control of MIDlet State Transitions
MIDlets have a lot of flexibility to control their own state. A MIDlet can call its own startApp(), pauseApp(), and destroyApp() methods, however those are the methods that the AMS uses to indicate a state transition to the MIDlet. The MIDlet can call those methods if it wishes to perform the work that it would typically do during that state transition.
Other sets of methods the MIDlet can use to cause state transitions are
resumeRequest(), notifyPaused(), and notifyDestroyed(). Since the system user interface has priority, a MIDlet cannot force itself into the active state, but it can request that it be resumed via a resumeRequest(). If the system is not busy, it will automatically grant the request. However, if the device is not in the idle screen, then it displays an alert dialog to the user to resume or end the MIDlet. If the user denies the request, the MIDlet is not notified, however if the user grants the request, the MIDlet’s startApp() method is called, and it gains focus when that finishes.
The MIDlet has more control when it decides it wants to be paused or destroyed. The MIDlet performs the necessary work by calling its own pauseApp() or destroyApp() method, then notifies the AMS of its intentions by calling notifyPaused() and notifyDestroyed() appropriately. Once notified, the AMS transition the MIDlet’s state and revoke focus.
Java System
The Java Settings Menu allows management of MIDlet suites, as well as system maintainance. The Java System feature gives statistics about the system such as:
•CLDC Version
•MIDP Version
•Data Space and Program Space (Free space)
•Total Heap Size
•The figure below depicts the Java System Menu.
29