Home > Store

Core J2ME Technology and MIDP

Register your product to gain access to bonus material or receive a coupon.

Core J2ME Technology and MIDP

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2002
  • Edition: 1st
  • Premium Website
  • ISBN-10: 0-13-066911-3
  • ISBN-13: 978-0-13-066911-7

Complete developers' guide to J2ME and the Mobile Information Device Profile 1.0.3.

  • Complete coverage of MIDP 1.0.3 for wireless developers
  • Practical applications of advanced J2ME and MIDP
  • Includes bonus chapter on MIDP for the Palm OS 1.0

J2ME is designed for devices with limited memory, display, and processing power including cellular phones, PDAs, and pagers. Core J2ME Technology & MIDP covers everything you need to develop powerful applications for this rapidly expanding wireless market.

Part I starts with an overview of J2ME, configurations, and profiles, before explaining in detail the Connected Limited Device Configuration (CLDC) and the Mobile Information Device Profile (MIDP). Muchow then walks you through creating a complete development environment-from downloading J2ME to troubleshooting.

Part II details programming with MIDP, including exhaustive coverage of the MIDP programming interface, high-level and low-level user interface components, networking support, and persistent storage.

An authoritative resource for programmers developing wireless applications, Core J2ME Technology & MIDP features:

  • Over 50 well-designed and clearly commented sample programs
  • A concise guide to using and installing MIDP for the Palm OS 1.0
  • A convenient, quick reference to MIDP and CLDC API's
  • Additional online resources available at www.CoreJ2ME.com

Sample Content

Online Sample Chapter

The Basics of J2ME

Table of Contents



Preface.


Acknowledgments.


About the Author.

I. INTRODUCTION TO J2ME, CLDC, AND MIDP.

1. The Basics of J2ME.

Java Editions. Why J2ME? Configurations. Profiles. Java Virtual Machines. Big Picture View of the Architecture. Compatibility between Java Editions. Putting all the Pieces Together.

2. Connected, Limited Device.

Configuration (CLDC). Hardware Requirements. Software Requirements. Java Virtual Machine Specification. Handling Security. Class File Verification. J2SE Inherited Classes. CLDC Specific Classes. K Virtual Machine.

3. Mobile Information Device Profile (MIDP).

Hardware and Software Requirements. MID Profile Architecture. MIDlet Suite. Accessing JAR and JAD Attributes from a MIDlet.

4. Development Environment.

Download the Software. Install the Software. Command Line Development. Packaging a MIDlet. Running a MIDlet on an Emulator. Download MIDlet onto a Mobile Device. Project Management Using Java Packages. J2ME Wireless Toolkit. Installation. Create a New Project. Configure the Project Settings. Write the Code and Build the Project. Using Java Packages. Locating the JAR and jad files. Configuring the Emulator. Toolkit Summary.

II. PROGRAMMING WITH MIDP.

5. Basics of MIDlets and the Display.

MIDlet. MIDletStateChangeException. Display. Displayable.

6. Event Handling.

The Big Picture. Command Objects. Item Objects. Command and CommandListener. Item and ItemStateListener.

7. High-level User Interface: Part I.

Screen. Form. Item. DateField. Gauge. StringItem. TextField. Choice and ChoiceGroup. Image and ImageItem.

8. High-level User Interface: Part II.

List. TextBox. Alert and AlertType. Ticker.

9. Low-level User Interface.

Canvas. Graphics.

10. Creating a Display Manager.

Animation MIDlet. Display Manager API. Animating a Series of Images. Source Code.

11. Record Management System (RMS).

Persistent Storage with the Record Store. Navigating with RecordEnumeration. Sorting with RecordComparator. Searching with RecordFilter. Notification of Changes with RecordListener. Exception Handling.

12. Todo List MIDlet: Part I.

Using the Todo List. Interface Design. Data Design. Application Logic. Source Code.

13. Scheduling Tasks.

Timer. TimerTask. Example: Timer Template. Example: Todo List MIDlet Part II—Delay Timer. Example: Animation with Timer/TimerTask.

14. Generic Connection Framework.

Connection Hierarchy. Http Connection.

15. MIDP for the Palm OS.

Device Requirements. Download. Installation. MIDlets. Configuring Preferences. Example: keyCodes and gameActions.

III. APPENDICES.

A. Over the Air User Initiated.

Provisioning Recommended Practice. General Information. Device Client. MIDlet Suite Upgrade. MIDlet Suite Removal. Server. WAP.

B. CLDC API.
C. MIDP API.
Index.

Preface

Preface

It is estimated that in Japan alone over 20 million Java 2 Micro Edition (J2ME) enabled mobile phones were manufactured in 2001. The opportunity for those interested in writing for the J2ME platform speaks for itself. With its support for a broad range of devices and portability across platforms, acceptance among manufacturers and service providers has been astounding.

The focus of this book is on application development using the Mobile Information Device Profile (MIDP) and Connected, Limited Device Configuration (CLDC). Together, these application programming interfaces (API's) form a complete J2ME development toolkit for wireless devices including: mobile phones, pagers and personal organizers.

Who Is This Book For

As a developer at heart, I have often sought a book that covered "all I need to know" to get started with a technology that was of interest. Instead I found myself putting together pieces and parts based on information from various websites, newsgroups, how-to articles, and the like. There was never one

definitive guide covering everything: where to find the software, how to install and configure my computer, and learning to write applications from the ground up. Most important of all, there always seemed to be gap between what information I could find and what appeared to be available as part of the specification describing the technology.

I hope this book is as close to one-stop shopping as you will find for learning and developing applications for J2ME and the Mobile Information Device Profile. It has what I feel are the essentials to get up and running, everything from downloading and installing the software to writing applications from simple to comprehensive. The entire programming interface is covered in a logical step-by-step manner, leaving no stone unturned. It also includes a quick reference guide for both MIDP and CLDC.

Although this book takes a step-by-step approach to teaching application development with MIDP, the assumption is made that the reader will have experience as a software developer. Further, as J2ME is a subset of Java 2 Standard Edition, a background in Java programming is essential to make the most of this book.

Focus of this Book

With many years of experience as a developer, and an extensive background in technical training, I've discovered that most people (myself included) learn best by example. With that in mind, this book provides an abundance of source code, with the intention of presenting solutions to real-world programming issues. With over 70 examples, you'll have an excellent base of code to build upon:

  • Creating a "clipboard" to share data among components
  • Using streams to read and write persistent storage
  • Searching and sorting records in persistent storage
  • Low-level event handling
  • Primitive drawing operations (arcs, rectangles, text, etc.)
  • Creating simple animations
  • Scheduling timers
  • Creating a client request and interpreting a server response using HTTP
  • How and when to use HTTP request methods GET and POST
  • Managing sessions with a Java Servlet through cookies and URL-rewriting
  • Using a thread to download network data in the background
  • Download and view files and images
  • Many additional examples . . .
Contents

This book is divided into three sections:

Part I: Introduction to J2ME, CLDC, and MIDP

We begin with an overview of Java 2 Micro Edition. This includes information about the architecture of J2ME and how configurations and profiles make it possible for this micro version of Java to support devices with an exceptionally wide range of capabilities. Also included are step-by-step instructions for installing the required software and configuring your computer to develop J2ME applications (MIDlets).

Part II: Programming with MIDP

Here you will find the bulk of information about programming with the MID Profile. Presented in a tutorial fashion, we cover each aspect of the application programming interface. For each topic there is a brief introduction, information about the API, followed by one or more examples to bring home the concepts presented. Following is a list of the main topics:

  • Basics of MIDlets and the Display
  • Event Handling
  • High-level User Interface
  • Low-level User Interface
  • Case Study: Building a Display Manager
  • Persistent Storage with the Record Management System
  • Case Study: Todo-List MIDlet
  • Scheduling Timers and Tasks
  • Network Communication with the Generic Connection Framework
  • MIDP for the Palm OS

The case studies tie together concepts presented throughout the book. The first builds a simple, yet very useful class to facilitate managing objects displayed on a mobile device. You'll learn why such a class is needed, how to design and create the class, and will see the class used within a MIDlet that demonstrates how to animate a series of images.

The second case-study builds a todo-list application. At nearly 900 lines of code this comprehensive example covers many aspects of MIDlet development from interface and data design to the internal application logic. This application also makes extensive use of the persistent storage mechanism provided in MIDP.

Part II: Appendices

There are three appendices:

*Over the Air User Initiated Provisioning Recommended Practice
This addendum to the MID Profile covers the recommended procedure for deploying MIDlets
*CLDC Quick Reference
Connected, Limited Device Configuration API divided into the following sections: java.io, java.lang, java.util, javax.microedition.io
*MIDP Quick Reference
Mobile Information Device Profile API
Mobile Information Device Emulators

Sun Microsystems provides two reference implementations of MIDP. These software packages are available for developers to use as a testing ground, and also provide device manufacturers with a model, or starting point, for creating an implementation of MIDP for a device(s).

The implementations available from Sun are:

*MIDP and CLDC as standalone packages
Applications are compiled and run from the command line
*J2ME Wireless Toolkit
Applications are compiled and run within a minimal development environment

The actual look and feel of MIDP components may vary across implementations and/or devices. This has to do with the fact MIDP does not spell out how components are to look, rather, it specifies the functionality they must provide.

For instance, the figure below shows the same application running on three different emulators. Although each looks different, the functionality remains consistent.

Throughout the book, all application screen-shots were created with one of the two Sun Microsystems reference implementations. If you download and install an implementation of MIDP from a device manufacturer, or a third-party source, examples may look different than shown in the book, however, the functionality should be equivalent.

CoreJ2ME.com Website

There is a companion website for this book: www.CoreJ2ME.com. Here you will find the latest source code for the examples in this book, important notes about changes to the MIDP and/or CLDC specification and how this effects the examples (if at all), how-to articles, links to the software, information about J2ME and MIDP training, and a developer resources section that includes links to tools, faqs, discussion areas, newsgroups and mailing lists, as well as other J2ME related websites.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020