Kicking Butt with MIDP and MSA Creating Great Mobile Applications

  • ISBN13:


  • ISBN10:


  • Edition: 1st
  • Format: Paperback
  • Copyright: 2007-12-29
  • Publisher: Addison-Wesley Professional
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $59.99 Save up to $2.40
  • eBook
    Add to Cart


Supplemental Materials

What is included with this book?

  • The eBook copy of this book is not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.


The release of MIDP 2.0 and the introduction of the new Mobile Service Architecture (MSA) are generating momentum for the Java ME platform. As more and more Java-enabled mobile devices become available and more service providers become open to third-party development, the demand for customized applications will grow dramatically. Now, there's a practical, realistic guide to building MIDP 2.0/MSA applications that are robust, responsive, maintainable, and fun. Long-time Java ME author Jonathan Knudsen offers real solutions for the complex challenges of coding efficiency, application design, and usability in constrained mobile environments. Experienced Java developers will master MIDP 2.0 and MSA programming through clear, carefully designed examples. Downloadable code is available for both NetBeans Mobility Pack and the Sun Java Wireless Toolkit.Kicking Butt with MIDP and MSA's wide-ranging content covers: Pushing MIDP's limits, and exploiting MSA's full power Using MIDlets, Forms, commands, core classes, and invocation Building effective mobile user interfaces Designing graphics with the Canvas, the Game API, SVG, and 3D Providing storage and resources: record stores, FileConnection, and PDA PIM Internationalizing mobile applications Networking via WMA, Bluetooth, Web services, and SIP Parsing XML documents Implementing audio and advanced multimedia Securing mobile applications with SATSA and the Payment API Building advanced location-based applications Designing applications for multiple devices Creating end-to-end mobile application architectures

Author Biography

Jonathan Knudsen, a technical writer at Sun, is coauthor of Beginning J2ME. He has written numerous articles about MIDP programming, and has developed several end-to-end Java ME applications. He has also authored or coauthored several books for O’Reilly Media, Inc., including The Unofficial Guide to Lego Mindstorms Robots, Java 2D Graphics, and Java Cryptography. He is a graduate of Princeton University.

Table of Contents

Foreword xvii
Preface xix
Acknowledgments xxi
About the Author xxiii
Getting Startedp. 1
Overview 31.1
Not Plastics, but Wireless 3 1.2
MIDP, the Heart and Soul of Mobile Java Technology 4 1.3
The First Umbrella: JTWI 5 1.4
A Bigger Umbrella: MSA 6 1.5
Understanding MSA APIs 7 1.6
Looking beyond MSA 1.0 9 1.7
What about JavaFX Mobile? 10 1.8
Summaryp. 10
Tools 112.1
Sun Java Wireless Toolkit for CLDC: A Toaster Oven 11 2.2
NetBeans Mobility Pack: A Gourmet Kitchen 13 2.3
Eclipse, Too 13 2.4
Inside a MIDlet Suite 14 2.5
Building a MIDlet Suite 15 2.6
The Command Line: A Campfire 16 2.7
Preprocessors 17 2.8
Obfuscators 17 2.9
Emulators 18 2.10
Device Testing 18 2.11
Summaryp. 19
Quick Start 213.1
Make Something That Runs 21 3.2
Put Something on the Screen 22 3.3
Give the User Something to Do 23 3.4
Get the Source Code Online 25 3.5
Summaryp. 26
Core APIs 274.1
JVM Features You Might Miss 28 4.2
Strings, Primitive Types, and System Methods 28 4.3
Threads 29 4.4
Using Streams for Input and Output 30 4.5
Dates, Collections, and Random Numbers 32 4.6
Summaryp. 33
The Lives of Midletsp. 35
The MIDlet Habitat 375.1
The MIDlet Life Cycle 37 5.2
Using the Browser and Making Calls 40 5.3
Application Properties 40 5.4
Protection Domains and Signed MIDlet Suites 41 5.5
Permissions 42 5.6
The Bottom Line on MIDlet Signing 44 5.7
Summaryp. 45
Starting MIDlets Automatically 476.1
Responding to Network Connections 47 6.2
Running a MIDlet at a Specific Time 54 6.3
Responding to Content 56 6.4
Summaryp. 66
User Interfacep. 67
Basic User Interface 697.1
How to Show Screens 70 7.2
TextBox, the Runt of the Litter 71 7.3
Input Modes 72 7.4
Using Alerts for Notifications 73 7.5
A Very Quick Introduction to Images 74 7.6
Putting It Together 74 7.7
Good for the Old Ticker 76 7.8
The Whole Story on Commands 76 7.9
Command Placement 79 7.10
Summaryp. 80
More User Interface 818.1
Lists 81 8.2
List Selections 83 8.3
Handling List Events 83 8.4
Three Lists in One Example 84 8.5
Advanced List Control 86 8.6
Using Forms 86 8.7
Working with Items 88 8.8
Gauges 89 8.9
Controlling Item Layout 90 8.10
Please Drink Form Responsibly 92 8.11
Item Change Events and Item Commands 95 8.12
Summaryp. 98
Graphicsp. 99
Creating Custom Screens 1019.1
Getting Information about the Display 101 9.2
How Painting Works 102 9.3
Making Colors 102 9.4
Drawing Lines and Shapes 105 9.5
Drawing Text 109 9.6
Measuring Text 111 9.7
Creating Images 114 9.8
Drawing Images 116 9.9
Keeping Resources Small 118 9.10
Drawing on Images 119 9.11
Getting Your Fingers on the Bits 121 9.12
Clipping 124 9.13
Event Handling 124 9.14
Controlling Command Placement 127 9.15
Summaryp. 129
Custom Items 13110.1
Custom Item Sizing 131 10.2
Painting 132 10.3
A Pretty Wait Indicator 132 10.4
Handling Events in Custom Items 135 10.5
Internal Traversal 136 10.6
An Interactive Example 137 10.7
Summaryp. 142
Using the Game API 14311.1
Tight Looping with GameCanvas 143 11.2
Building Scenes with Layers 148 11.3
Tiled Layers 149 11.4
Sprites 151 11.5
Detecting Collisions 153 11.6
Assembling a Game Scene 153 11.7
A Blocky Example 154 11.8
Summaryp. 158
Scalable Vector Graphics 15912.1
The Simplest Way to Show SVG Content 160 12.2
Working with Animated Documents 163 12.3
Digging into an SVG Document 166 12.4
Displaying an SVG Document on Your Own Canvas 168 12.5
Creating New SVG Elements 171 12.6
SVG Event Handling 174 12.7
Summaryp. 178
3D Graphics 17913.1
Creating M3G Files 179 13.2
Displaying 3D Content the Easy Way 180 13.3
Doing It the Hard Way 184 13.4
Summaryp. 192
Table of Contents provided by Publisher. All Rights Reserved.


This book is about creating applications for cell phones and other small devices. Help Me Help You The best way to learn programming is by doing it. Try something, and if it works, tweak it and try again. A good book gives you lots of things to try and tweak. If you just read the text of this book, you'll miss about half of the content. I put just as much sweat into making the examples clear and instructive as I put into writing the text. The best way to read this book is sitting in front of your computer, trying out the examples as you go along. You can download the source code for the book from the Web site: http://kickbutt.jonathanknudsen.com/download.html The examples are available for NetBeans Mobility and the Sun Java Wireless Toolkit. You can read about these tools in Chapter 2. The following instructions describe how to load and run a chapter's sample code in either tool. Running Examples Using NetBeans Mobility Download the zip file for the chapter. Unzip it to a location of your choice. In NetBeans, choose File >Open Project...from the menu. Navigate to the project and open it. You can run the project by choosing Run >Run Main Project. Running Examples Using the Sun Java Wireless Toolkit Download the zip file for the chapter. Unzip it to the apps folder under the toolkit's installation directory. For example, if the toolkit is installed in c:\WTK2.5.1, and you've downloaded the examples from Chapter 11, unzip the file to create the directory c:\WTK2.5.1\apps\kb-ch11. Now, in KToolbar, open the kb-ch11 project. Run the project by clicking Run. Finding API Documentation As you read through this book, you should also have immediate access to the relevant API documentation. This book explains how to use APIs in practical terms, while the API documentation is a definitive reference for classes and methods. Documentation for many of the APIs discussed in this book is online here: http://java.sun.com/javame/reference/apis.jsp For the remaining APIs, you can download the relevant specifications from the Java Community Process Web site: http://jcp.org/ The Real World Many of the APIs described in this book are quite new. The MSA specification is so new that real devices do not yet implement it, and the MSA subset is just beginning to make its way to the real world. That means that some of the features described in this book will be available to you only in the desktop emulator, at least in the near term. Whenever possible, I have tested the examples in this book on the real devices I have available.

Rewards Program

Write a Review