MIDlet's User Interface

The example MIDlet covers API features that might not be supported in some devices. For example, devices not supporting orientation detection will have the compass feature disabled on the TouristRoute MIDlet.

The figure below demonstrates the flow of typical MIDlet use. On startup, the MIDlet tries to connect to a location provider. At this point, real devices might display a list of discovered Bluetooth devices. Emulators such as the Prototype SDK usually skip Bluetooth device listing, and will immediately start looking for location data. When a connection to a location provider is available, the TouristRoute MIDlet will switch to the Route view (middle screen shot in the top row in below figure) and begin to update location information.

By pressing the Editor command the user may switch to the Landmark Editor view. In this view, the user may edit address information for the current device location. By selecting the Save command, address information will be saved to the device's landmark store. The List command selection would switch the current view to the Landmarks list (left screen shot in the bottom row in below figure) without saving the landmark. The Landmarks list view contains all the saved landmarks. Also, the Save command selection on the landmark editor switches the current view to the Landmarks list view

Figure 165: Screen flow from MIDlet start to landmark addition

Devices and emulators supporting orientation will have an extra Compass command available on the Route view. Pressing the Compass command switches the view to a Compass view, which shows compass information. Pressing the Pitch and Roll command on the Compass view allows switching to the Pitch and Roll view. This view displays device's pitch (tilt) and roll (rotation in degrees around device's own longitudinal axis). The Location API example in this guide provides orientation support.

From a code point of view, the use of the TouristRoute MIDlet begins from the TouristUI Canvas class, which displays the current position of the device. From TouristUI, the user may switch either to the LandMarkEditorUI or CompassUI class. However, switching to CompassUI is possible only if the device or emulator supports orientation. The CompassUI class enables switching to the PitchRollUI class. In addition, all the UI classes allow a possibility to switch back to the previous display. The Displayable class switches are shown in below figure.

Figure 166: TouristRoute example MIDlet's UI view changes

In brief, the tasks of the UI classes are the following: