RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Mobilize Your Java Applications with Java ME Technologies

Read this beginner's guide to extending an enterprise application to mobile devices with the Java ME technologies.

his article walks through creating a Java mobile application for a J2ME-enabled mobile camera device. While it does not cover all of the neccesary aspects in depth, it does describe how to build the basic structure for the application. The completed Java mobile application will enable the user to do:
  1. Take a picture.
  2. Fill out a form to provide some information about the picture.
  3. Send the picture and information to a server as data.

Then the mobile application can access this data on the server, allowing the user to view and edit it later. A possible use case for this application would be an insurance adjuster in the field assessing an auto claim. The adjuster would use a mobile camera device to take a photo of the damage, add vital information to it (client name, account number, VIN, date, etc.), and send the data to a central server at the insurance company.

To provide this functionality, the application will be part of a larger architecture that includes the following:

  • The mobile application
  • A deployment server
  • A server-side gateway script
  • A server-side database

The code for the application will employ the following mobile Java technologies:

  • J2ME (Java 2 Micro Edition), now Java ME (Java Micro Edition): targets mobile devices and embedded systems
  • MIDP (Mobile Information Device Profile): targets devices with an intermittent network connection and low memory, such as mobile phones
  • Midlet: an application written for MIDP

MIDP is composed of the following main concepts:

  • User interface: User Interface includes two levels: the high level (text input, date input, list of items, etc.) is based on widgets; the low level is based on a canvas (at the pixels level).
  • Local storage of data: The local storage of data (RMS: Record Management System) is a simple record-oriented database to persistently store information.
  • Communication: The communication is based on a generic framework (GCF: Generic Communications Framework) that supports HTTP, HTTPS, sockets, etc.
  • Multimedia: MIDP supports sound, vibrator, backlight, camera control, and video.

The target J2ME-enabled camera devices for the application have a number of constraints that will shape the scope of the application. Table 1 lists the main constraints a developer must understand and some solutions to address them.

Table 1. Main Constraints of Mobile Devices
Constraints Suggested Solutions
Limited memory (JAR file)
  • Reduce the size of the resources (especially images).
  • Reduce the number of classes in the JAR file.
  • Limited memory (heap memory)
  • Minimize the use of memory.
  • Eliminate instantiation of objects wherever possible.
  • Mark as available all the large allocations of memory.
  • Limited processor power Profile slow-running code to find the bottlenecks.
    Limited storage
  • Use the JAR file for storage.
  • Read from the network.
  • Limited bandwidth Use a different type of connection (for example, intermittent connections).
    Limited screen size Employ mechanisms such as zoom, scrollbars, etc.

    Of course, a small mobile application that uses common features will run up against fewer constraints.

    Close Icon
    Thanks for your registration, follow us on our social networks to keep up-to-date