SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Complete developers' guide to J2ME and the Mobile Information Device Profile 1.0.3.
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:
Event Handling Through the Item Object
Handling Events Using the MIDP Command Object
MIDlets and the Display: The Basics
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.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 ForAs 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 BookWith 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:
This book is divided into three sections:
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).
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:
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.
There are three appendices:
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:
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 WebsiteThere 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.