Developing applications with Java

Nokia Asha provides a few alternatives for developing Java applications. The following information can be used to select the best approach for designing and developing your application.

Choosing your approach

Custom UI on Canvas Using LCDUI high-level components Using LWUIT components
  • Full screen apps or apps with chrome (Status bar and Header).
  • Everything drawn on Canvas pixel by pixel.
  • Good approach for game development.
  • LCDUI high-level components and Nokia UI API's are in use.
  • Components are styled with Asha look & feel.
  • Custom components can be created with CustomItem.
  • Offers a more comprehensive component set with many customisation options.
  • Components are styled with Asha look and feel, but also custom theming is easy for branded look and feel.

Custom UI on Canvas

Canvas class is the main template for customised MIDlet functions. Using Canvas, the MIDlet can use any drawing primitives provided by the LCDUI Graphics interface and can receive key events. The drawback is that the MIDlet will not be as portable as ones created using only high-level APIs.

A common example of a MIDlet that uses Canvas is a mobile game that requires pixel-accurate drawing and access to low-level keypad events. Read more information about Canvas from the Java Developer's Library.

Using LCDUI high-level components

Limited Connected Device User Interface (LCDUI) is the base of any Graphical User Interface (GUI) created in Java™ ME (Java Platform, Micro Edition). It has a similar role to the Abstract Windowing Toolkit (AWT) and Swing APIs, which are used in Java SE (Java Platform, Standard Edition) and Java EE (Java Platform, Enterprise Edition), but offers a more restricted and resource-efficient approach to UI development.

LCDUI has a simple screen-based approach, where a single Displayable is always active in the display area of the application user interface. This Displayable can contain predefined screen elements, or be manipulated in more specific ways.

On a logical level, the MIDP (Mobile Information Device Profile) UI is divided into two levels: high and low. In general, the choice is made between the easy, quick and portable high-level APIs and the more customisable low-level APIs.

Figure 1. LCDUI overview

Read more about the LCDUI from the Java Developer's library.

Using LWUIT components

LWUIT (LightWeight UI Toolkit) is an open source alternative that provides a comprehensive selection of customisable UI components, layouts, and effects. Use of the ready-made Nokia Asha theme for the components is recommended, but developers can also easily create their own custom themes for branded look and feel. LWUIT is highly portable, as it scales to different screen resolutions and orientations, and has built-in support for touch and non-touch UI.

LWUIT applications are created on top of LCDUI Canvas. Though LWUIT has been optimised for Nokia Asha phones, LCDUI is a better option for performance critical applications, especially on phones with cost-optimised hardware. Also, when a compact application binary size is crucial, LCDUI should be considered instead, because the LWUIT library is added to every LWUIT application and it increases the application size by 200-800 kB (depending on the application features).

Figure 2. LWUIT overview