In this blog, 25.000 books will be uploaded, so far more than 1400 books are available. Books, will be added daily, please check this blog daily.
Friday, September 24, 2010
Cracking the Code Wireless Programming with J2ME
Contents
Preface.........................................................................................................viii
Chapter 1: An Overview of J2ME .................................................................1
Introduction ............................................................................................................................................ 1
What J2ME is about......................................................................................................................... 1
What J2ME offers........................................................................................................................... 2
J2ME Virtual Machines .......................................................................................................................... 3
The K Virtual Machine (KVM) ...................................................................................................... 3
The C Virtual Machine (CVM)....................................................................................................... 4
Configurations ........................................................................................................................................ 5
CLDC.............................................................................................................................................. 5
CDC................................................................................................................................................. 7
Profiles.................................................................................................................................................... 8
Mobile Information Device Profile (MIDP)................................................................................... 8
Foundation Profile ........................................................................................................................... 9
Other profiles .................................................................................................................................. 9
Getting Set to Program with J2ME....................................................................................................... 10
Our First J2ME Application.................................................................................................................. 10
RelatedJava Technologies.................................................................................................................... 12
PersonalJava.................................................................................................................................. 12
Java Card....................................................................................................................................... 13
Summary............................................................................................................................................... 15
Chapter 2: Programming Techniques for J2ME........................................16
Constraints of J2ME Targeted Devices................................................................................................ 16
Limited processor speed ................................................................................................................ 16
Limited memory and storage......................................................................................................... 17
Limited networking and bandwidth .............................................................................................. 17
Wide variety of input/output methods .......................................................................................... 18
Size, shape, and weight.................................................................................................................. 20
Rapid changes in the world of small devices................................................................................ 21
Operating systems for mobile devices .......................................................................................... 21
Programming Techniques to Counter the Limitations......................................................................... 22
Do not overload the processor....................................................................................................... 22
Conserve memory to the maximum extent ................................................................................... 22
Pass the load to the server ............................................................................................................. 24
Avoid using string concatenation.................................................................................................. 24
Give the garbage collector light work........................................................................................... 24
Use exceptions sparingly............................................................................................................... 24
Use local variables ......................................................................................................................... 24
Make your suite light..................................................................................................................... 24
Managing with the limited features of J2ME....................................................................................... 25
Plan your application well ............................................................................................................. 25
Use GUI classes optimally and creatively.....................................................................................25
Use the server’s functionality ........................................................................................................25
Use low-level UI APIs in MIDP....................................................................................................25
Use SyncML for data synchronization ..........................................................................................26
Summary ...............................................................................................................................................26
..................................27
Core Packages.......................................................................................................................................27
java.lang package ...........................................................................................................................27
java.io package ...............................................................................................................................27
java.util package .............................................................................................................................28
Brief introduction to commonly used packages............................................................................28
Generic Connection Framework ...........................................................................................................31
Kjava API..............................................................................................................................................33
Brief introduction to commonly used classes .......................................................................................36
Spotlet ............................................................................................................................................36
Graphics.........................................................................................................................................37
Button.............................................................................................................................................37
TextField........................................................................................................................................38
RadioButton and RadioGroup........................................................................................................38
HelpDisplay ...................................................................................................................................39
ScrollTextBox................................................................................................................................39
Database.........................................................................................................................................40
TextBox .........................................................................................................................................41
Installation of CLDC .............................................................................................................................41
Compiling, preverifying, and running applications ......................................................................42
Case Studies ..........................................................................................................................................43
TextField_Spotlet ...........................................................................................................................43
ScrollTextBox_Spotlet...................................................................................................................45
HelpDisplay_Spotlet ......................................................................................................................47
CheckRadio_Spotlet.......................................................................................................................49
HttpCheck_Spotlet .........................................................................................................................52
Server .............................................................................................................................................55
Socket_Check ................................................................................................................................55
Summary ...............................................................................................................................................62
Chapter 4: MIDP-MIDlet Implementation with Case Studies....................63
MIDlets and MIDlet States....................................................................................................................63
MIDlet Suites ........................................................................................................................................64
MIDP API .............................................................................................................................................64
Application Lifecycle Package..............................................................................................................65
User Interface Package ..........................................................................................................................66
Interface CommandListener...........................................................................................................67
Alert Class .....................................................................................................................................68
ChoiceGroup Class.........................................................................................................................69
Command Class.............................................................................................................................70
Display Class .................................................................................................................................71
Form Class.....................................................................................................................................71
Gauge Class ...................................................................................................................................72
Graphics Class ............................................................................................................................... 73
Class List....................................................................................................................................... 75
Class StringItem............................................................................................................................ 76
Class TextField .............................................................................................................................. 76
Class TextBox............................................................................................................................... 77
Class Ticker................................................................................................................................... 78
Persistence Package.............................................................................................................................. 78
Class RecordStore......................................................................................................................... 79
Exceptions in Persistance Package................................................................................................ 82
Installation of MIDP and Running Applications ................................................................................. 82
run.bat............................................................................................................................................ 83
sample.bat...................................................................................................................................... 84
example.jad ................................................................................................................................... 85
J2ME Wireless Toolkit ......................................................................................................................... 85
MIDP for Palm ..................................................................................................................................... 86
Case Studies.......................................................................................................................................... 91
TextFieldCheck............................................................................................................................. 91
LabelUI ......................................................................................................................................... 93
ChoiceGroupUI............................................................................................................................. 95
TickerUI ........................................................................................................................................ 98
MenuCheck ................................................................................................................................... 99
AddressBook............................................................................................................................... 101
TestHTTP.................................................................................................................................... 109
Summary............................................................................................................................................. 111
Chapter 5: Handling and Parsing XML in J2ME ......................................112
Brief Overview of XML ..................................................................................................................... 112
Structure of XML......................................................................................................................... 112
XML Schema.............................................................................................................................. 114
XML Parsing ...................................................................................................................................... 114
XML parsers available for KVM ................................................................................................ 115
Working with kXML........................................................................................................................... 115
org.kxml parser package ............................................................................................................. 116
org.kxml.io package..................................................................................................................... 117
Application ......................................................................................................................................... 117
Structure of the application ......................................................................................................... 117
Functioning of the application..................................................................................................... 117
Application description................................................................................................................ 117
Summary............................................................................................................................................. 124
Chapter 6: Project 1: Online Testing Engine...........................................125
User Interface ..................................................................................................................................... 125
Running the Project............................................................................................................................ 126
How It Works ..................................................................................................................................... 126
TestManager flow chart............................................................................................................... 132
TestManager.java ............................................................................................................................... 134
MainScreen.java................................................................................................................................. 139
QuestionParser.java............................................................................................................................ 155
Books.asp............................................................................................................................................ 159
TestFile.asp .........................................................................................................................................161
Summary .............................................................................................................................................163
Chapter 7: Project 2: Online Ordering System........................................164
User Interface......................................................................................................................................164
Running the Application.....................................................................................................................164
How It Works......................................................................................................................................165
Summary .............................................................................................................................................184
Chapter 8: Project 3: MP3 Player for Pocket PC .....................................185
Working with the CDC Specification .................................................................................................185
Using Emulated Environments............................................................................................................186
The PersonalJava Emulation Environment .................................................................................186
The Pocket PC emulation environment.......................................................................................188
Working without emulation .........................................................................................................189
JavaCheck ...........................................................................................................................................189
Introducing the project........................................................................................................................193
How It Works......................................................................................................................................193
How to Run .........................................................................................................................................200
Working With Wireless Networks ......................................................................................................201
Summary .............................................................................................................................................218
Chapter 9: Project 4 : Peer-to-Peer Search Application.........................219
User Interface......................................................................................................................................219
How It Works......................................................................................................................................220
Source Code ........................................................................................................................................226
Summary .............................................................................................................................................274
Chapter 10: Project 5: Mobile Web Services...........................................275
User Interface......................................................................................................................................275
How to Run .........................................................................................................................................278
How It Works......................................................................................................................................278
MainClass.java .............................................................................................................................291
DataParser.java............................................................................................................................294
Weather.java ................................................................................................................................305
News.java.....................................................................................................................................311
MoviesList.java ............................................................................................................................319
Summary .............................................................................................................................................328
Chapter 11: Project 6: Target Practice Game..........................................329
User Interface......................................................................................................................................329
How It Works......................................................................................................................................330
Source Code ........................................................................................................................................334
Code explanation.........................................................................................................................339
MainClass.java .............................................................................................................................340
Summary .............................................................................................................................................354
Chapter 12: Converting J2SE Applications to J2ME ..............................355
Issues Involved in Conversion ............................................................................................................355
Differences in Java language support and virtual machines.......................................................355
Differences in the hardware......................................................................................................... 356
Problems due to device variety ................................................................................................... 356
Differences in the application models......................................................................................... 357
Differences in APIs...................................................................................................................... 357
What Conversion Entails .................................................................................................................... 358
Modifying the application design, if necessary .......................................................................... 358
Reducing the GUI ........................................................................................................................ 358
Removing unnecessary or impossible functionality................................................................... 359
Optimizing the use of resources .................................................................................................. 359
Using JavaCheck ................................................................................................................................ 359
An Example of Conversion................................................................................................................. 361
Analyzing the design ................................................................................................................... 361
Reducing the GUI ........................................................................................................................ 362
Is some functionality unnecessary or impossible? ..................................................................... 363
Listing the items consuming resources ....................................................................................... 364
Testing the application................................................................................................................. 365
Summary............................................................................................................................................. 365
Appendix A: About the CD-ROM ..............................................................366
System Requirements......................................................................................................................... 366
What’s on the CD............................................................................................................................... 366
Source code................................................................................................................................. 366
Applications ................................................................................................................................ 367
E-Book ........................................................................................................................................ 367
Troubleshooting.................................................................................................................................. 367
Index ...........................................................................................................369
End User License Agreement...................................................................377
Sun Microsystems, Inc. Binary Code License Agreement.....................379
License Agreement: Forte for Java, Release 2.0 Community Edition
for All Platforms ......................................................................................382
Download
Another J2ME Books
Another Wireless Network Books
Another Hacker Books
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment