Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
J2ME GUI Programming
1. J2ME : GUI Programming
Rohan Chandane
rohan.chandane@gmail.com
These notes are created by me, Rohan Chandane as learning material while pursuing MSc(CA) from SICSR 2005-2007 (CC)
2. Use of Profile
For GUI Programming we can use
different Profiles
Here, we will see Mobile Information
Device Profile (MIDP)
3. 3 things in MIDP
MIDlets
High-Level API
Low-Level API
5. Continued…
A MIDlet can exist in four different states
Loaded
MIDlet is loaded into the device
The constructor is called,
This is called the loaded state
Active
After loaded state of MIDlet, it is in the active
state
Until its paused or destroyed
6. Continued…
Paused
Applications should stop animations
Release resources that are not needed
This state avoids
Resource conflicts with the application running in
the foreground
Unnecessary battery consumption
Destroyed
MIDlet gets Terminated
8. Continued…
startApp()
The program manager starts the
application by calling the startApp()
method, then MIDlet get loaded
pauseApp()
Pauses the MIDlet
9. Continued…
destroyApp()
provides an unconditional parameter
If false - MIDlet is allowed to refuse its
termination & Throws
MIDletStateChangeException
resumeRequest() - If a MIDlet need to
resume activity, this informs application
manager
10. Continued…
notifyPaused() - If a MIDlet need to go to
the paused state, this informs application
manager
notifyDestroyed() – In order to terminate,
this informs application manager
11. User Interface Architecture
MIDP 2.0 has two UI Package
javax.microedition.lcdui
lcdui - Liquid Crystal Display User Interface
javax.microedition.lcdui.game
For development of a wireless game UI
13. Continued…
High Level Group
Classes provided are
Perfect for development of MIDlets
that target the maximum number of devices
Heavily abstracted
to provide minimal control over their look and feel
Classes do not provide exact control over
their display
15. Continued…
Low Level Group
Classes provided are
Perfect for MIDlets
where we want precise control over the location and
display of the UI elements
If more control there is comes less portability
It may not be deployable on certain devices
17. Displayable Interface
To show a UI element on a device
screen Displayable Interface must
implemented in Midlet
Whether high or low level APIs, it have
to implement Displayable Interface
The Graphics class does not implement
this interface
Because it deals with low-level 2D graphics
that directly manipulate the device's screen
19. High-Level API
Event handling
Two Categories of Events
Command events
Command events are triggered by key presses on
the device
Item events
Item events are the result of visual components
changing on the display