Java Reference
In-Depth Information
Of course, JAR files can contain more than just classes. You can obtain a named resource
in your JAR file using java.lang.Class.getResourceAsStream , which returns an InputStream to
the file in JAR file. The javax.microedition.lcdui.Image class, which is responsible for draw-
ing bitmap images in PNG format, also includes the createImage class method, which takes a
path to an image and returns an Image instance that's ready to display.
Managing Startup Events and Alarms
In addition to user input, external events such as incoming messages and alarms can
trigger the activation of your MIDlet. To use an external event to trigger the activation of
your MIDlet, your MIDlet must register with the AMS to indicate that it wants to receive
push events, and it must have the privilege to do so.
When the MIDlet is not running, the AMS and the MIDlet share responsibility for
handling an incoming event, whether it's an alarm or an incoming connection request
(see Figure 4-3). The AMS monitors registered push events on behalf of inactive MIDlets,
and it starts MIDlets in response to incoming events. On the other hand, when the
MIDlet is running, the push directory sends the push event directly to the MIDlet.
Figure 4-3. The relationship between the AMS and the MIDlets awaiting startup events
Search WWH ::




Custom Search