Introduction

At the JavaOne conference 1999, the Java 2 Micro Edition (J2ME) was initially introduced. J2ME is a Java 2 platform, specially designed for embedded devices such as consumer electronics, cell phones, and PDAs.

This book covers the Connected Limited Device Configuration (CLDC) and the two profiles available for CLDC, the Mobile Information Device Profile (MIDP) and the Personal Digital Assistant Profile (PDAP).

Note

Note that the PDAP-related information covered in this book is based on the PDAP Public Draft Specification, which may slightly differ from the final specification; see http://www.jcp.org/jsr/detail/75.jsp.

Corresponding updates, including sample applications, can be found at the Web site of this book—http://www.samspublishing.com; enter the book's ISBN (0672320959).


The intention of this book is to help you to understand the architecture the J2ME technology, especially CLDC, MIDP, and PDAP, and show you how to use it by creating real-world sample applications.

Audience

This book is intended for Java developers with general Java experience gained by creating Java 2 Standard Edition applications for the desktop computer. If you aren't yet familiar with Java syntax and semantics, we recommend that you first start by using Java tutorials available through the Web or by going to book stores focusing on the Java language. We do not assume that you have J2ME development experience at this point.

The Structure of This Book

This book is organized in ten chapters and two appendixes. The chapters and appendixes cover the topics listed as follows:

Chapter 1, “Java 2 Micro Edition Overview,” gives a general overview of the Java 2 Micro Edition (J2ME). Starting from the Green Project, the origin of the J2ME technology, it introduces the CLDC and its profiles, tells you how to create a small hello world application, and gives an overview about currently available CLDC based development tools.

Chapter 2, “The Connected Limited Device Configuration,” describes the general concepts and limitations of the CLDC and also takes a closer look at the API packages available in it. The packages and classes of the Mobile Information Device (MID) and Personal Digital Assistant (PDA) profiles, including extensions of CLDC classes, are then discussed.

Chapter 3, “MIDP Programming,” handles the life cycle and user interface of MIDP applications and discusses their general design. Then, the high-level user interface API will be explained. Finally, the low-level user interface API for free graphics and games will be described, and we will give a short overview of the new MIDP 2.0.

Chapter 4, “PDAP Programming,” handles the life cycle and user interface of PDA applications. First, the general design of PDA applications will be discussed. Then, the AWT subset forming the PDAP user interface API will be explained.

Chapter 5, “Data Persistency,” describes the Record Store Management System (RMS) that is used in MIDP and PDAP to store data on a cell phone or PDA persistently. We will show the basic use of Record Stores and tell you how to use iterators in order to access stored records. Finally, we describe the new RecordStore methods, which are added by MIDP 2.0.

Chapter 6, “Networking: The Generic Connection Framework,” describes a framework that is used in J2ME for network connections. We will describe the structure of this framework, show you how to establish Socket, Datagram, and HTTP connections, and show their use by implementing a client/server chat application.

Chapter 7, “PIM: Accessing the Personal Information Manager,” describes the Personal Information Manager that is included in PDAP. Here, we will show you the concepts of the PIM and also show you how to create a demo application for handling contacts.

Chapter 8, “Size Does Matter: Optimizing J2ME Applications,” shows you how to optimize J2ME applications by describing some essential hints for J2ME application programming.

Chapter 9, “Advanced Application: Blood Sugar Log,” shows you how to create an advanced application by splitting its functionality into two parts; one basic part that can be used in a MIDP and PDAP application as well and the profile specific GUI part in which a profile specific user interface is created.

Chapter 10, “Third-Party Libraries,” by creating small example applications, this chapter introduces some third-party libraries such as a substitution for the lack of floating point support, XML parsers, and a SOAP implementation for J2ME.

Appendix A, “Class Library: CLDC Packages,” gives an overview of all packages included in CLDC, MIDP, and PDAP.

Appendix B, “Comparison Charts,” includes a great set of tables where we compare classes of J2ME with their J2SE counterparts. Each package that is available in J2SE and J2ME is listed in detail to show you which classes and methods are available in CLDC or CLDC-NG (also known as CLDC version 1.1). If applicable, we provide workarounds to substitute a particular method of J2SE by a corresponding set of calls or using other classes to gain the same functionality as in J2SE.

Software Development Kits Used to Create the Example Applications

In order to compile and build the MIDP based example applications provided in this book, we recommend that you use Sun's J2ME Wireless Toolkit v1.0.3 in standalone mode (not the Forte integration). Follow the installation steps provided by Sun to set up the Wireless Toolkit properly.

Since a reference implementation for PDAP isn't available at the time of publishing this book, we recommend that you use the J2SE desktop AWT in order to create PDAP AWT applications. In order to get emulations of the additional J2ME packages, such as RMS or the Generic Connection Framework for J2SE, refer to the ME4SE project, available at the Web site http://me4se.org.

If you want to run a PDAP application on a real PDA such as a Palm organizer, you can use the Jbed VM that is available from the Swiss company esmertec Inc. (http://www.esmertec.com) together with a kAWT implementation supporting most of the PDAP features at this time. For PDAs where a Personal Java implementation is available, you can also use Personal Java, together with some of the ME4SE classes.

Web Site

You can download the source code for the example applications discussed in this book from www.samspublishing.com. When you reach the page, just enter the book's ISBN (0672320959) and follow the Source Code link.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset