Tuesday, April 20, 2010

Java 2 Micro Edition
















contents
preface xv
acknowledgments xviii
about this book xx
about the cover illustration xxiii
Part 1 Developing with J2ME 1
1 Introduction 3
1.1 So what is J2ME anyway? 3
Where is J2ME being applied? 4
1.2 What is a small device? 5
The vast consumer space 5
Consumer electronic and embedded devices 6
1.3 J2ME’s role in wireless and mobile applications 7
Is J2ME mobile? 7 ✦ Is J2ME wireless? 8
Wireless vs. mobile 9
1.4 The Java 2 edition trilogy 9
J2SE 10 ✦ J2EE 10
J2ME 11 ✦ Why we need J2ME 11
1.5 The case for Java 12
Is Java right for small devices? 12 ✦ Java’s beneficial features 13
1.6 Origins of J2ME 15
Java’s origins 15 ✦ The return of Java in small devices 16
1.7 The J2ME community 16
J2ME’s guiding light, the Java Community Process 16
1.8 J2ME products and alternatives 17
1.9 Summary 18
2 J2ME architecture 19
2.1 Goals of the J2ME architecture 19
Support for multiple devices 20
Support for device-specific functionality 20
Maintaining a common architecture 21
2.2 Accommodating opposing needs 21
Configurations and profiles 22 ✦ A high-level view of J2ME 23
2.3 Configurations: a closer look 24
Connected Limited Device Configuration (CLDC) 25
The Kilobyte Virtual Machine (KVM) 27
Connected Device Configuration (CDC) 28
C-Virtual Machine (CVM) 29
2.4 Profiles: a closer look 29
Two types of profiles 30 ✦ Profiles are modular 30
J2ME profiles extend J2ME configurations 31
2.5 Choosing a J2ME profile 31
Mobile Information Device Profile (MIDP) 32
PDA Profile (PDAP) 32 ✦ Foundation Profile 32
Personal Profile 32 ✦ RMI Profile 33 ✦ Personal Basis Profile 33
Multimedia Profile 33 ✦ Gaming Profile 34
Wireless Telephony Communications API (WTCA) 34 ✦ KJava 34
2.6 Write once, run anywhere issues 35
Varied device needs 35 ✦ J2ME architecture increases WORA 36
2.7 Runtime environment 36
2.8 Designing J2ME applications 36
2.9 Summary 38
3 Developing a J2ME application 39
3.1 Investment quote application requirements 40
The investment quote application customer 40
Requirements analysis 41
3.2 Designing the investment quote application 42
Application control 42 ✦ User interface design 43
Persistent storage 45 ✦ Networking and input/output 46
3.3 Developing J2ME applications 48
Obtaining the development environment 48
Creating the applications 49 ✦ Runtime environment 49
3.4 Investment quote application tour guide 50
3.5 Summary 51
Part 2 Developing for cellular phones and pagers 53
4 A simple MIDP application 55
4.1 Questions about the MIDP development environment 56
Can I do this without an actual device? 56
What device do I start with? 56
Do I have to use the command line tools? 56
The example: what are we going to do? 56
4.2 Developing MIDP applications 56
Getting started 57 ✦ What is a MIDlet? 58
Compiling the application 60 ✦ Preverifying the application 61
Running the application 61 ✦ Troubleshooting 62
JARing MIDlets 63 ✦ Developing MIDlet suites 64
Running MIDlet suites from a web server 67
Installing MIDlet suites locally 67
4.3 Summary 68
5 MIDP user interface 69
5.1 MIDP application control 70
5.2 The investment quote application control in MIDP 71
5.3 Two types of MIDP user interface and event handling 75
High-level API 76 ✦ Low-level API 76
5.4 The MIDP user interface API 77
MIDP display control 77 ✦ MIDP high-level user interface API 78
MIDP low-level user interface API 87
The investment quote application’s user interface in MIDP 91
5.5 Handling user interactions in MIDP 105
High-level event handling 107 ✦ Low-level event handling 110
Handling the events of the Investment Quote Application 114
5.6 MIDlets on other devices 130
5.7 Summary 133
6 MIDP data storage 134
6.1 JDBC parallel 135
6.2 Storage structure 136
Record store 136 ✦ Records in the record store 137
6.3 RMS API 138
Record store construction and access 138 ✦ Record store exceptions 141
Record store listener 142 ✦ Comparing records 144
Filtering records 145 ✦ Enumerating through records 146
6.4 Persistent storage in the investment quote application 149
Defining the stock/mutual fund record 149
Storing quotes 150 ✦ Retrieving quotes 156
6.5 Summary 166
7 Connecting to the Internet 167
7.1 Micro edition package connectivity 168
Using the Connector class to open a channel 168
7.2 Similar but smaller I/O package 169
Streams 170 ✦ Readers/Writers 170
7.3 Implementing the Internet investment quote service 171
Getting a quote service connection 172
Extracting the price quote from the HTML 177
The MIDlet’s handling of quote data 180
7.4 Summary 186
Part 3 Developing for PDAs 187
8 J2ME on a PDA, a KJava introduction 189
8.1 PDA profile alternatives 190
Java PDA development environments 190
What is KJava? 191 ✦ What is MIDP for Palm OS? 192
8.2 HiSmallWorld in KJava 192
Getting Started 192 ✦ What is a Spotlet? 193
Compiling HiSmallWorld 194 ✦ Preverifying KJava applications 197
Creating the Palm OS application 198 ✦ Running the application 202
8.3 Deploying to the actual device 211
8.4 HiSmallWorld revisited using MIDP for Palm OS 213
MIDP application code 214 ✦ Converting the JAR file to PRC 215
Deploying the MIDP for Palm OS applications 216
8.5 Summary 217
9 KJava user interface 218
9.1 KJava application control 219
9.2 The investment quote application control in KJava 220
9.3 KJava user interface 225
Drawing to the display with the graphics object 225 ✦ Components 231
Custom components 239 ✦ KJava collection classes 239
9.4 The investment quote application’s user interface in KJava 240
Creating and displaying components 240 ✦ Drawing with graphics 244
9.5 Handling user interactions in KJava 248
Spotlet event-processing methods 248 ✦ Handling beaming events 250
9.6 Handling the events of the investment quote application in KJava 250
Handling key entry events 250 ✦ Handling pen taps 252
Handling pen movement 255
9.7 Summary 261
10 KJava data storage 262
10.1 Palm OS databases 263
Different types of Palm OS databases 263
Palm OS record database 263
10.2 KJava database API 265
Opening and creating databases 265 ✦ Accessing the database 267
10.3 Implementing the investment quote persistent storage in KJava 268
The stock/mutual fund record 268
Storing investment quotes 269 ✦ Retrieving records 273
10.4 Revisiting the connection to the Internet 275
10.5 Accessing Palm OS application databases 285
10.6 Summary 287
Part 4 Developing for the enterprise:
beyond the specifications 289
11 Real-world design 291
11.1 Dealing with stakeholders 292
Get them familiar with the devices early 292 ✦ Set expectations 293
Gathering requirements 293 ✦ State of the organization 293
11.2 A development scenario 294
Analysis 295 ✦ Options 296
11.3 Guidelines for building J2ME applications 298
The user interface 298 ✦ The network 304
Data exchange formats 306 ✦ Data synchronization 312
Data storage 317 ✦ Memory 319
Portability between profiles 320
Security 322 ✦ Internationalization 323
11.4 Architectural tools and techniques 325
Questionnaire: assessing if mobile and wireless is a good fit 325
Mobile application models 326 ✦ Architect’s checklist 329
11.5 Summary 331
12 Integrating the server 332
12.1 Examining server integration 333
Avoid monolithic applications 333
12.2 What technology to connect to? 334
12.3 Servlet example 334
12.4 XML 347
Using XML 348 ✦ Open standards of XML 350
Consequences of XML in J2ME 351 ✦ Small-footprint parsers 351
12.5 XML using JSPs example 353
How JavaServer Pages work 353 ✦ Creating the JSPHelper 355
Creating the JSP 357 ✦ Creating the J2ME Client 358
12.6 Summary 364
13 The network connection 365
13.1 About the Generic Connection Framework 366
Where the Generic Connection Framework lives 367
Working with the Connector class 368 ✦ The Connector is a factory 370
How the Connector finds the correct class 370
13.2 Using the Generic Connection Framework 372
13.3 HTTP-based connections 372
Establishing a connection 372 ✦ Using the connection 373
Compiling and running the application 376
13.4 Socket-based connections 377
Writing to sockets 378 ✦ Reading from sockets 380
When to use sockets 381 ✦ Client-server socket example 381
13.5 Datagram-based connections 394
Datagram example 397
13.6 Summary 406
14 J2ME runtime environment 407
14.1 The Java runtime environment 408
Lifecycle of the Java Virtual Machine 408
Java Virtual Machine responsibilities 411
14.2 The J2ME runtime environment 415
14.3 CLDC-compliant virtual machines (the KVM) 415
KVM lifecycle 416 ✦ Preverification 416
In-device verification 417 ✦ Security 417
Unsupported Java features 419 ✦ Multithreading 421
Garbage collection 421 ✦ Internationalization 422
Application management (JAM) 422 ✦ Java Code Compact (JCC) 423
Deployed classes 424 ✦ Debug support 424
14.4 CDC-compliant virtual machines (the CVM) 425
Garbage collection and the CVM 426
Memory references in the CVM 426
14.5 Summary 427
15 Related technologies 428
15.1 J2ME implementations 429
esmertec’s Jbed 429
Motorola’s Embedded Reference Implementation (MERI) 430
15.2 The other Sun specifications 430
PersonalJava 430 ✦ EmbeddedJava 434
15.3 Non-J2ME alternatives 435
ChaiVM by Hewlett-Packard 435 ✦ IBM’s VisualAge Micro Edition 435
Waba by Wabasoft 438
15.4 Related Java technologies 438
Java Card 438 ✦ Java Native Interface 439
Jini 441 ✦ JavaPhone and Java TV APIs 442
15.5 Non-Java alternatives 442
WAP/WML 443 ✦ Other languages 443
15.6 Data storage and synchronization 444
Data storage 444 ✦ A data synchronization standard, SyncML 445
XML 446
15.7 J2ME supplementary technology 448
GUI, kAWT 448 ✦ Web browsing, Kbrowser 449
Encryption, Bouncy Castle 449
15.8 Summary 449
A J2ME development tools 451
B J2ME resources 453
C Java and J2ME history 456
C.1 Oak and the Green Project 456
C.2 Java and the Internet 457
C.3 Evolution of Java 458
Java 1.02 459 ✦ Java 1.1 459
Java 2 459 ✦ SDK 1.3 460
Java 3 coming soon? 460 ✦ Java today 460
C.4 Origins of J2ME 460
Micro-Java rebirth 461 ✦ Early access versions of J2ME 461
J2ME’s continuing evolution 462 ✦ J2ME today 463
D J2ME Wireless Toolkit 464
D.1 Downloading the Wireless Toolkit 464
D.2 Installing the J2ME Wireless Toolkit 465
D.3 Hello World project revisited 466
Starting the toolkit 466 ✦ Creating a project 467
Editing the project settings 469 ✦ Entering the Java code 470
Building a project 470 ✦ Running a project 470
Palm OS Emulator 471 ✦ Operating from the command line 472
D.4 Summary 472
index 473


Download this book click here

Another J2ME Books
Another Smart Phone Books
Another Mobile Programming Books

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!