Part of the new Cracking the Code Series, Wireless
Programming with
J2ME provides a look at the code behind
wireless
Java applications.
Think of J2ME as a tiny version of Java specifically for
mobile devices -- perfect for bringing powerful, robust
applications to mobile phone, pagers, PDAs, and other
handhelds. Writing applications for handheld and mobile
devices is different than regular Java programming. Mobile
developers have to deal with limited screen real estate,
bandwidth and computing power. This book covers six
wireless applications complete with Flow Diagrams and
line-by-line code description. It covers all of J2ME
including CDC,CLDC and MIDP with an emphasis on practical
code.
Contents
Foreword
Preface
Chapter 1: An Overview of
J2ME
- What J2ME is about
What J2ME offers
J2ME Virtual Machines
-
The K Virtual Machine (KVM)
The C Virtual Machine (CVM)
- Configurations
-
CLDC
CDC
- Profiles
-
Mobile Information Device Profile (MIDP)
Foundation Profile
Other profiles
Getting Set to Program with J2ME
Our First J2ME Applicatio
- RelatedJava Technologies
-
PersonalJava
Java Card
- Summary
- Chapter 2: Programming
Techniques for J2ME
Constraints of J2ME Targeted Devices
-
Limited processor speed
Limited memory and storage
Limited networking and bandwidth
Wide variety of input/output methods
Size, shape, and weight
Rapid changes in the world of small devices
Operating systems for mobile devices
- Programming Techniques to Counter the Limitations
-
Do not overload the processor
Conserve memory to the maximum extent
Pass the load to the server
Avoid using string concatenatio
Give the garbage collector light work
Use exceptions sparingly
Use local variables
Make your suite light
- Managing with the limited features of J2ME
-
Plan your application well
Use GUI classes optimally and creatively
Use the server's functionality
Use low-level UI APIs in MIDP
Use SyncML for data synchronizatio
- Summary
Chapter 3: CLDC API and
Reference Implementatio
- Core Packages
-
java.lang package
java.io package
java.util package
Brief introduction to commonly used packages
- Generic Connection Framework
Kjava API
Brief introduction to commonly used classes
-
Spotlet
Graphics
Butto
TextField
RadioButton and RadioGroup
HelpDisplay
ScrollTextBox
Database
TextBox
- Installation of CLDC
-
Compiling, preverifying, and running applications
- Case Studies
-
TextField_Spotlet
ScrollTextBox_Spotlet
HelpDisplay_Spotlet
CheckRadio_Spotlet
HttpCheck_Spotlet
Server
Socket_Check
- Summary
Chapter 4: MIDP-MIDlet
Implementation with Case Studies
- MIDlets and MIDlet States
MIDlet Suites
MIDP API
Application Lifecycle Package
User Interface Package
-
Interface CommandListener
Alert Class
ChoiceGroup Class
Command Class
Display Class
Form Class
Gauge Class
Graphics Class
Class List
Class StringItem
Class TextField
Class TextBox
Class Ticker
- Persistence Package
-
Class RecordStore
Exceptions in Persistance Package
Installation of MIDP and Running Applications
run.bat
sample.bat
example.jad
- J2ME Wireless Toolkit
MIDP for Palm
Case Studies
-
TextFieldCheck
LabelUI
ChoiceGroupUI
TickerUI
MenuCheck
AddressBook
TestHTTP
- Summary
Chapter 5: Handling and
Parsing XML in J2ME
- Brief Overview of XML
-
Structure of XML
XML Schema
- XML Parsing
-
XML parsers available for KVM
- Working with kXML
-
org.kxml parser package
org.kxml.io package
Applicatio
Structure of the applicatio
Functioning of the applicatio
Application descriptio
- Summary
Chapter 6: Project 1: Online Testing Engine
User Interface
Running the Project
How It Works
-
TestManager flow chart
- TestManager.java
MainScreen.java
QuestionParser.java
Books.asp
TestFile.asp
Summary
Chapter 7: Project 2: Online
Ordering System
- User Interface
Running the Applicatio
How It Works
Summary
Chapter 8: Project 3: MP3
Player for Pocket PC
- Working with the CDC Specificatio
Using Emulated Environments
-
The PersonalJava Emulation Environment
The Pocket PC emulation environment
Working without emulatio
- JavaCheck
Introducing the project
How It Works
How to Ru
Working With Wireless Networks
Summary
Chapter 9: Project 4 :
Peer-to-Peer Search Applicatio
- User Interface
How It Works
Source Code
Summary
Chapter 10: Project 5: Mobile
Web Services
User Interface
How to Ru
How It Works
MainClass.java
DataParser.java
Weather.java
News.java
MoviesList.java
Summary
Chapter11: Target Practice
Game
- User Interface
How It Works
Source Code
-
Code explanatio
MainClass.java
- Summary
Chapter 12: Converting J2SE
Applications to J2ME
- Issues Involved in Conversio
-
Differences in Java language support and virtual
machines
Differences in the hardware
Problems due to device variety
Differences in the application models
Differences in APIs
- What Conversion Entails
-
Modifying the application design, if necessary
Reducing the GUI
Removing unnecessary or impossible functionality
Optimizing the use of resources
- Using JavaCheck
An Example of Conversio
-
Analyzing the desig
Reducing the GUI
Is some functionality unnecessary or impossible?
Listing the items consuming resources
Testing the applicatio
- Summary
Appendix A: About the
CD-ROM
- System Requirements
What's on the CD
-
Source code
Applications
- E-Book
Troubleshooting
Index
End User
License Agreement
Sun
Microsystems, Inc. Binary Code License Agreement
License
Agreement: Forte for Java, Release 2.0 Community Editionfor
All Platforms
Amendment
No. 1 to Binary License and Redistribution Agreement