Books Related to Java, Core Java, Jquery, Web Services, SCJP, Spring, Hibernate and J2ME

Monday, April 27, 2009

Introduction to J2ME

J2ME (Java 2 Platform, Micro Edition) was designed by Sun Microsystems, it is a java technology that allows java programmers to use the Java programming language and j2me tools to develop programs for mobile phones, pagers, wireless devices and personal digital assistants (PDA). The j2me have limited processing power, limited storage capabilities and low-bandwidth network connections. J2ME consists of programming specifications and a special virtual machine, the K Virtual Machine, that allows a J2ME-encoded program to run in the mobile device.


J2ME programming specifications:

  • Connected, Limited Device Configuration (CLDC)
  • Mobile Information Device Profile (MIDP).

CLDC:

  • it defines the Java environment for mobile phone, pager and wireless devices
  • CLDC devices are normally wireless
  • Memory available for Java 160 - 512k
  • typically it has limited power or battery operated
  • network connectivity, often wireless, intermittent, low-bandwidth (9600bps or less)

MIDP:

  • this is the application environment for wireless devices based on the CLDC
  • it holds classes for user interface, storage and networking

MIDlet:

A MIDlet is a J2ME application which handle on an MIDP. MIDlets are J2ME optimized servlet API and architecture-based applications for Java enabled devices such as wireless device, PDA, cell phones and the RIM BlackBerry. A MIDlet is specified with at least a single class that is derived from the javax.microedition.midlet.MIDlet abstract class.

A MIDlet is an event-based application. All functions executed in the MIDlet are raised in response to an event reported to the MIDlet by the application manager. The initial event that happens is when the MIDlet is started and the application manager invokes the startApp() method. The startApp() method in a typical MIDlet holds a statement that displays a screen of data and prompts the user to enter a selection from among one or more options. A Command object is used to present a user with a selection of options to choose from when a screen is displayed. Each screen must have a CommandListener. A CommandListener monitors user events with a screen and causes the appropriate code to execute based on the current event.

JAR Files:

  • Nine attributes are defined in this file. The first six attributes are necessary.
  • The file’s extension is changed to .mf when the MIDlet is prepared for deployment.
  • All entries are name: value pairs.
  • Each pair must be terminated with a carriage return.
  • White space between the colon and the attribute value is ignored.

Manifest File: Necessary Attribute

  • MIDlet-Name: MIDlet suite name.
  • MIDlet-Version: MIDlet version number.
  • MIDlet-Vendor: Name of the vendor who supplied the MIDlet.
  • MIDlet-n: Attribute per MIDlet. Values are MIDlet name, optional icon, and MIDlet class name.
  • MicroEdition-Profile: Identifies the J2ME profile that is necessary to run the MIDlet.
  • MicroEdition-Configuration: Identifies the J2ME configuration that is necessary to run the MIDlet.

Optional Attribute

  • MIDlet-Icon: Icon associated with MIDlet, must be in PNG image format.
  • MIDlet-Description: Description of MIDlet.
  • MIDlet-Info-URL: URL containing more information about the MIDlet.

JAD File

JAD Files is used to pass the parameters to a MIDlet without modifying the JAR file. It must have the .jad extension. It also used to provide the application manager with additional content information about the JAR file to determine whether the MIDlet suite can be implemented on the device. There are five necessary attributes for a JAD file:

  • MIDlet-Name: MIDlet suite name.
  • MIDlet-Version: MIDlet version number.
  • MIDlet-Vendor: Name of the vendor who supplied the MIDlet.
  • MIDlet-n: Location of the JAR file.
  • MIDlet-Jar-URL: Attribute per MIDlet. Values are MIDlet name, optional icon, and MIDlet class name.

Optional Attribute:

  • MIDlet-Jar-Size: Size of the JAR file in bytes.
  • MIDlet-Data-Size: Minimum size (in bytes) for persistent data storage.
  • MIDlet-Description: Description of MIDlet.
  • MIDlet-Delete-Confirm: Confirmation required before removing the MIDlet suite.
  • MIDlet-Install-Notify: Send installation status to given URL.

No comments:

Post a Comment