J2ME Programming/MIDP1

(Redirected from Programming:J2ME:MIDP1)

Introduction

edit

While in The J2ME Platform we covered the whole J2ME platform, in this article we will be covering Mobile Information Device Profile 1.0(MIDP1.0). While CLDC covers the subset of Java language used in MIDP devices, MIDP covers such areas as the graphical user interface and etc.

Connection Protocols

edit

The CLDC defines the language definitions and operation of the input/output. However, the protoc,mm ols that flow over this connection are defined by the Mobile Information Device Profile(MIDP). In the MIDP1.0 the HTTP protocol is defined and used by the javax.microedition.io.HttpConnection class.

MIDlet

edit

In MIDP application development the application container in which everything occurs is called the MIDlet. The javax.microedition.midlet.* package set of classes define the MIDlet lifecycle and the MIDlet states.


http//javax.microedition.midlet.MIDlet

RMS, or Record Management Storage, is the persistent storage used in MIDP mobile devices. While the RMS classes define how the RMS operates they do not define how much total kilobytes the RMS can take off the heap. That information is usually found by either reading the OS datasheet when the OS includes their own JVM, such as SymbianOS, or from the JVM datasheet itself, or the device series datasheet.

RMS classes

edit
  • javax.microedition.rms.InvaidRecordIDException
  • javax.microedition.rms.RecordComparator
  • javax.microedition.rms.RecordEnumeration
  • javax.microedition.rms.RecordFilter
  • javax.microedition.rms.RecordListener
  • javax.microedition.rms.RecordStore
  • javax.microedition.rms.RecordStoreException
  • javax.microedition.rms.RecordStoreFullException
  • javax.microedition.rms.RecordStoreNotFoundException
  • javax.microedition.rms.RecordStoreNotOpenException

LCDUI, the MIDP GUI APIs

edit

In MIDP MIDlet development there are two APIs defined for the graphical user interface that are contained in the same Limited Connected Device User interface(LCDUI) packages. The low level API gives pixel control over placement of graphical items on the screen and is used heavily in games. The high level interface has lightweight widgets to make business application gui building easier for developers.

Displayable Object

edit

Both the High Level LCDUI API and the Low Level LCDUI API use the displayable object to send graphical data/objects to the screen to be displayed.

Displayable Classes

edit
  • javax.microedition.lcdui.Display
  • javax.microedition.lcdui.Display

High Level LCDUI API

edit

The High Level LCDUI API classes are:

High Level LCDUI API Classes

edit
  • javax.microedition.lcdui.Alert
  • javax.microedition.lcdui.AlertType
  • javax.microedition.lcdui.Choice
  • javax.microedition.lcdui.ChoiceGroup
  • javax.microedition.lcdui.Form
  • javax.microedition.lcdui.Gauge
  • javax.microedition.lcdui.ImageItem
  • javax.microedition.lcdui.Item
  • javax.microedition.lcdui.ItemStateListener
  • javax.microedition.lcdui.List
  • javax.microedition.lcdui.Screen
  • javax.microedition.lcdui.StringItem
  • javax.microedition.lcdui.TextBox
  • javax.microedition.lcdui.TextField
  • javax.microedition.lcdui.Ticker

Screen

edit

At this point, we have to be careful as there are two Screens referred to in javadocs. We are referring to the both subclasses of Screen that are in the Displayable class. Both encapsulate the High Level API. The first subclass of Screen under Displayable does not allow the removing of high level widgets once they are placed on screen such as List, TextBox, and Alert. The second subclass of Screen under Displayable allows one to place and remove widgets.

Low Level LCDUI API

edit

An easy way to keep these two APIs clear in your mind is that High Level APIs are always have more classes than the Low Level APIs so that more complex graphical objects can be generated by just using a few methods.NKS

Low Level LCDUI API Classes

edit
  • javax.microedition.lcdui.Canvas
  • javax.microedition.lcdui.Graphics
  • javax.microedition.lcdui.Font
  • javax.microedition.lcdui.Image

Conclusion

edit

With these short concepts in mind you should be able to understand that the CLDC covers the java language subset used in MIDlet development and the MIDP classes cover the user interface, connection protocols, and persistent storage.

References

edit
  • The J2ME Platform
  • "MIDP White Paper" (PDF). MIDP APIs for Wireless Applications White Paper.(http://java.sun.com/products/midp/midp-wirelessapps-wp.pdf)

Trademark Notices

edit

J2ME, Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.