Java Reference
In-Depth Information
get_exitCommand : This method lazily creates an instance of the exit command used
by the MIDlet to signal application exit.
get_alarmAlert : This method lazily creates the alarm alert message.
Wrapping Up
The javax.microedition.midlet class encapsulates the notion of an MIDP application,
called a MIDlet. To implement a MIDlet, you must subclass this class and provide four
functions: the constructor, startApp , pauseApp , and destroyApp . The AMS invokes these
methods as your MIDlet transitions from paused to active to destroyed (potentially
entering the paused and active states multiple times as the native platform interrupts
your application). You can cause one of these transitions; for example, you can force
your MIDlet to exit by invoking notifyDestroy after cleaning up the resources used
by your MIDlet.
MIDlets are packaged as suites contained within a JAR file that contains both the
classes implementing the MIDlets for a suite and a manifest that describes the suite
through properties such as the MIDlet suite name, the icon, and individual MIDlet
names, icons, and MIDlet subclasses. The JAR file is usually accompanied by a second
file—the descriptor ( JAD) file—which contains the same properties identified in the
manifest file. You can query the property list for a MIDlet using the MIDlet method
getAppProperty , or you can load a file from the JAR file using the Class method
getResourceAsStream .
Not just user actions invoke MIDlets. MIDlets can also start in response to incoming
events such as connection requests or timer events. You can schedule an alarm using the
push registry registerAlarm method, which specifies the MIDlet to start and when to
start. For running MIDlets, you'll want to subclass TimerTask and use an instance of the
Timer class to run your task.
 
Search WWH ::




Custom Search