Creating a ContactBookDemo application

This topic describes how to a simple application that displays names from the Phonebook using the JSR-75 PIM API. The application UI is built using the following LWUIT UI components and features:

  • Form

  • List

  • Layout

  • TextArea (using Nokia TextEditor)

The application defines a minimal set of softkeys to ensure that the application is easy to use: the Exit and Clear commands are mapped to the right softkey and the Options menu to the left softkey.

This is where we were with the source code:

import javax.microedition.midlet.MIDlet;
import com.sun.lwuit.Command;
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;

public class Midlet
    
    extends MIDlet {
    
    public void startApp() {
        Display.init(this);
        Form form = new Form("Hello World");
        form.show();
    }
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
}

Display.init is a static method that creates a device-specific implementation class instance behind the scenes and sets some parameters based on, for example, the number of softkeys and whether or not the device has a touch screen. Form's in LWUIT are analogous to LCDUI's forms and represent different screens in the application.

The following topics describe how to create a ContactBookDemo application with information about security prompts and signing. It also lists the complete source code of the ContactBookDemo application.