Wireless Java Programming with J2ME [Feng & Zhu 2001-05-21].pdf

(6706 KB) Pobierz
Wireless Java Programming
with Java 2 Micro Edition
Yu Feng and Jun Zhu
201 West 103rd St., Indianapolis, Indiana, 46290 USA
Wireless Java Programming with Java 2
Micro Edition
Copyright © 2001 by Sams Publishing
All rights reserved. No part of this book shall be reproduced, stored in a
retrieval system, or transmitted by any means, electronic, mechanical, photo-
copying, recording, or otherwise, without written permission from the pub-
lisher. No patent liability is assumed with respect to the use of the information
contained herein. Although every precaution has been taken in the preparation
of this book, the publisher and authors assume no responsibility for errors or
omissions. Nor is any liability assumed for damages resulting from the use of
the information contained herein.
International Standard Book Number: 0-672-32135-1
Library of Congress Catalog Card Number: 2001086072
Printed in the United States of America
First Printing: June 2001
04 03 02 01
4 3 2 1
E
XECUTIVE
E
DITOR
Michael Stephens
A
CQUISITIONS
E
DITOR
Carol Ackerman
D
EVELOPMENT
E
DITOR
Tiffany Taylor
M
ANAGING
E
DITOR
Matt Purcell
P
ROJECT
E
DITOR
Christina Smith
C
OPY
E
DITOR
Kim Cofer
I
NDEXER
Eric Schroeder
P
ROOFREADER
Benjamin Berg
Trademarks
All terms mentioned in this book that are known to be trademarks or service
marks have been appropriately capitalized. Sams Publishing cannot attest to
the accuracy of this information. Use of a term in this book should not be
regarded as affecting the validity of any trademark or service mark.
T
ECHNICAL
E
DITOR
David Fox
T
EAM
C
OORDINATOR
Lynne Williams
I
NTERIOR
D
ESIGNER
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as
possible, but no warranty or fitness is implied. The information provided is on
an “as is” basis. The authors and the publisher shall have neither liability nor
responsibility to any person or entity with respect to any loss or damages aris-
ing from the information contained in this book.
Anne Jones
C
OVER
D
ESIGNER
Aren Howell
Contents at a Glance
Introduction
1
P
ART
I
1
2
3
4
P
ART
II
5
6
7
8
9
10
11
12
P
ART
III
A
B
C
D
Getting Started
Introduction to Wireless Application Development
7
Java for Wireless Devices
13
Java Wireless Programming Basics
33
Packaging and Deploying Java Wireless Applications
55
Developing Wireless Applications Using Java
Central Components of the UI for Wireless Devices
79
Using High-Level APIs in UI Development
109
Using Low-Level APIs in UI Development
167
Persistent Storage
237
Basic Network Programming in J2ME MIDP
283
Using XML in Wireless Applications
335
A Complete Example: MotoShop
379
Data Synchronization for Wireless Applications
407
Appendixes
CLDC Class Libraries
453
MIDP Class Libraries
459
Resource Links
463
NTT DoCoMo’s Java for i-Mode
467
Index
477
Contents
Introduction
1
P
ART
I
1
Getting Started
Introduction to Wireless Application Development 7
Introduction..............................................................................................8
WAP and i-Mode ....................................................................................8
The History of WAP ..........................................................................8
The History of i-Mode........................................................................9
Limitations..........................................................................................9
Java 2 Micro Edition..............................................................................10
Platform Independence ....................................................................10
Simple Programming Language ......................................................10
Rich Network Functionality ............................................................10
Built-in Security Model....................................................................10
Dynamic Application Deployment ..................................................10
Distributed Computing ....................................................................11
Graphical User Interface ..................................................................11
Developer Community ....................................................................11
The Future..............................................................................................11
Summary ................................................................................................12
Java for Wireless Devices 13
Overview................................................................................................14
The Big Picture ......................................................................................14
What Is J2ME? ......................................................................................15
J2ME’s Configurations ....................................................................16
J2ME’s Virtual Machines ................................................................17
J2ME’s Profiles ................................................................................17
J2ME for Wireless Devices ..................................................................18
MIDP/CLDC/KVM ..........................................................................19
Hardware Requirements ..................................................................20
Wireless Devices ..............................................................................21
JavaPhone Versus MIDP ..................................................................23
Setting Up the Development Environment............................................26
Installing the J2ME Wireless Toolkit for Windows ........................27
Installing MotoSDK for Windows ..................................................29
Summary ................................................................................................31
2
Zgłoś jeśli naruszono regulamin