MIDlet Program Structure

Now that you understand the application execution lifecycle, it's time to look at the source code of a simple MIDlet. You might have already surmised that I'm going to start by showing you the simplest MIDlet—the MIDP version of the inveterate “Hello World” program. Listing 3.1 shows the source code for the first version of the HelloWorld MIDlet.

Code Listing 3.1. This is the MIDP version of the familiar HelloWorld program.
 import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.midlet.MIDlet; /** Creates the "Hello world" program in J2ME MIDP. Note that the class must be public so that the device application management software ...

Get Wireless J2ME™ Platform Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.