Programming Wireless Devices with the Java 2 Platform, Micro Edition

Similar documents
Acknowledgments Introduction p. 1 The Wireless Internet Revolution p. 1 Why Java Technology for Wireless Devices? p. 2 A Bit of History p.

The Unified Modeling Language User Guide

PYTHON. p ykos vtawynivis. Second eciitiovl. CO Ve, WESLEY J. CHUN

Programming in Python 3

Programming. In Ada JOHN BARNES TT ADDISON-WESLEY

Software Development & Education Center. Java Platform, Micro Edition. (Mobile Java)

BVRIT HYDERABAD College of Engineering for Women Department of Information Technology. Hand Out

Who am I? Wireless Online Game Development for Mobile Device. What games can you make after this course? Are you take the right course?

LATEX. Leslie Lamport. Digital Equipment Corporation. Illustrations by Duane Bibby. v ADDISON-WESLEY

Framework Design Guidelines

DAY 3 J2ME March 2007 Aalborg University, Mobile Device Group Mobile Phone Programming

Quality Code. Software Testing Principles, Practices, and Patterns. Stephen Vance. AAddison-Wesley

Cloud Computing and SOA Convergence in Your Enterprise

Mobile Information Device Profile (MIDP) Alessandro Cogliati. Helsinki University of Technology Telecommunications Software and Multimedia Laboratory

A Document Preparation System. User's Guide and Reference Manual. Leslie Lamport

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

World Wide Web PROGRAMMING THE PEARSON EIGHTH EDITION. University of Colorado at Colorado Springs

\ Smart Client 0" Deploymentwith v^ ClickOnce

Real-Time Systems and Programming Languages

Developer's HTML5. Cookbook. AAddison-Wesley. Chuck Hudson. Tom Leadbetter. Upper Saddle River, NJ Boston Indianapolis San Francisco

ST.MARTIN'S ENGINEERING COLLEGE Dhulapally,Secunderabad-014

The Power of Events. An Introduction to Complex Event Processing in Distributed Enterprise Systems. David Luckham

Minne menet, Mobiili-Java?

ECLIPSE RICH CLIENT PLATFORM

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

Programming. Principles and Practice Using C++ Bjarne Stroustrup. / Addison-Wesley. Second Edition

Modern C++ Design. Generic Programming and Design Patterns Applied. Andrei Alexandrescu

Refactoring HTML. Improving the Design of Existing Web Applications. Elliotte Rusty Harold. TT rvaddison-wesley

Application Programming

Fit for Developing Software

CLASSIC DATA STRUCTURES IN JAVA

Domain-Specific. Languages. Martin Fowler. AAddison-Wesley. Sydney Tokyo. With Rebecca Parsons

Modern C++ Design. Generic Programming and Design Patterns Applied. Andrei Alexandrescu. AAddison-Wesley

Mobile Application Development. J2ME - Forms

Modern C++ Design. Generic Programming and Design Patterns Applied. Andrei Alexandrescu. .~Addison-Wesley

OpenGL SUPERBIBLE. Fifth Edition. Comprehensive Tutorial and Reference. Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak

Digital System Design with SystemVerilog

SQL Queries. for. Mere Mortals. Third Edition. A Hands-On Guide to Data Manipulation in SQL. John L. Viescas Michael J. Hernandez

Mobile Application Development. Introduction. Dr. Christelle Scharff Pace University, USA

JUGAT meeting. Roman Waitz Development. MATERNA Information & Communications

Programming with POSIX Threads

Rails AntiPatterns. Chad Pytel. Best Practice Ruby on Rails Refactoring. Tammer Saleh. AAddison-Wesley

Secure Coding in C and C++

MariaDB Crash Course. A Addison-Wesley. Ben Forta. Upper Saddle River, NJ Boston. Indianapolis. Singapore Mexico City. Cape Town Sydney.

Xcode 6 Start to Finish

Programming HD DVD and Blu-ray Diso The HD Cookbook

JAVASCRIPT FOR PROGRAMMERS

IPHONE FOR PROGRAMMERS: AN APP-DRIVEN APPROACH

ECLIPSE MODELING PROJECT

Java Smart Ticket Demo Application Scrutinized

Introduction to Computer Graphics

J2ME crash course. Harald Holone

Project Overview. Readings and References. Initial project motivation. Opportunity. References. CSE 403, Winter 2003 Software Engineering

DVB-HTML MIDP 2.0 Graphics Architectures for Non-Desktop Devices

Opengl Programming On Mac Os X Architecture Performance

Project Overview. CSE 403, Spring 2003 Software Engineering.

Project Overview. Readings and References. Opportunity. Initial project motivation. References. CSE 403, Spring 2003 Software Engineering

Network Programming With Go Essential Skills For Using And Securing Networks

Sortware Comprehension and Μaintenance

ony Gaddis Haywood Community College STARTING OUT WITH PEARSON Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto

Elements Of Programming Interviews In Python The Insiders Guide

Core Java Volume Ii Advanced Features 10th Edition

Visual C# Tony Gaddis. Haywood Community College STARTING OUT WITH. Piyali Sengupta. Third Edition. Global Edition contributions by.

Jim Jackson II Ian Gilman

Database Concepts. David M. Kroenke UNIVERSITATSBIBLIOTHEK HANNOVER

Distributed Gaming using J2ME. By Rekha Vaddepalli

TAMZ. JavaME. MIDlets. Department of Computer Science VŠB-Technical University of Ostrava

C for Electronic Engineering

DAY 3 J2ME Aalborg University, Mobile Device Group. Mobile. Mobile Phone Programming

J2ME ARCHITECTURE AND RELATED EMBEDDED TECHNOLOGIES

DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA

Mobile Station Execution Environment (MExE( MExE) Developing web applications for PDAs and Cellphones. WAP (Wireless Application Protocol)

PeopleSoft PeopleTools Tips & Techniques

NETWORKING KEITH W. ROSS. Polytechnic Institute of NYU. Addison-Wesley

[ Team LiB ] Publisher: Addison Wesley Pub Date: June 13, 2003 ISBN: Pages: 464

DATABASE SYSTEM CONCEPTS

Virtualization from the Trenches

PROBLEM SOLVING USING JAVA WITH DATA STRUCTURES. A Multimedia Approach. Mark Guzdial and Barbara Ericson PEARSON. College of Computing

THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS. Using Assembly and С

Prelude to Programming

Essentials. Oracle Solaris Cluster. Tim Read. Upper Saddle River, NJ Boston Indianapolis San Francisco. Capetown Sydney Tokyo Singapore Mexico City

Objects First with Java

An Introduction to Search Engines and Web Navigation

Programming 8-bit PIC Microcontrollers in С

JAVA. Java Micro Edition

Lab Exercise 4. Please follow the instruction in Workshop Note 4 to complete this exercise.

Eclipse Building Commercial-Quality Plug-ins Second Edition

OpenGL. Shading Language. Third Edition

Fundamentals of. Database Systems. Shamkant B. Navathe. College of Computing Georgia Institute of Technology PEARSON.

Eclipse Plug-ins. Third Edition

The Java Tutorial. A Short Course on the Basics. Raymond Gallardo. Sowmya Kannan. AAddison-Wesley. Sharon Biocca Zakhour.

Elements Of Programming Interviews In Java The Insiders Guide

Integrated Approach. Operating Systems COMPUTER SYSTEMS. LEAHY, Jr. Georgia Institute of Technology. Umakishore RAMACHANDRAN. William D.

BlackBerry Java Development Environment Version 3.2. Developer Guide

Data Structures and Abstractions with Java

Algorithmic Graph Theory and Perfect Graphs

ECE 750 T11 Component Based Software Systems Project Presentation II Nilam Kaushik (Group 7) University of Waterloo Faculty of Engineering

MECHATRONICS. William Bolton. Sixth Edition ELECTRONIC CONTROL SYSTEMS ENGINEERING IN MECHANICAL AND ELECTRICAL PEARSON

DB2 SQL Tuning Tips for z/os Developers

An Introduction to Programming with IDL

Transcription:

Programming Wireless Devices with the Java 2 Platform, Micro Edition J2ME Connected Limited Device Configuration (CLDC) Mobile Information Device Profile (MIDP) Roger Riggs Antero Taivalsaari Mark VandenBrink Jim Holliday, Editor ADDISON-WESLEY Boston San Francisco New York Toronto Montreal London Munich Paris Madrid Capetown Sydney Tokyo Singapore Mexico City

Contents Figures Foreword Preface Acknowledgments xiii xv xvii xxi Introduction 1 1.1 The Wireless Internet Revolution 1 1.2 Why Java Technology for Wireless Devices? 2 1.3 A Bit of History 3 1.4 J2ME Standardization Efforts 4 Overview of Java 2 Platform, Micro Edition (J2ME ) 7 2.1 Java 2 Platform 7 2.2 Java 2 Platform, Micro Edition (J2ME) 8 2.3 Key Concepts of the J2ME Architecture 10 2.3.1 Profiles 12 2.3.2 Configurations 14 2.4 The K Virtual Machine (KVM) 16 Goals, Requirements, and Scope 19 3.1 High-Level Goals 19 3.1.1 Dynamic delivery of Java applications and content 20 3.1.2 Third-party application development 20 3.1.3 Independence of network technology standards 21 3.1.4 Compatibility with other wireless application standards... 22 3.2 Target Devices 22 3.3 General Notes on Consumer Devices and Embedded Systems 24 3.4 Requirements 26 3.4.1 Hardware requirements of CLDC 27 Vll

3.4.2 Hardware requirements of MIDP 28 3.4.3 Software requirements of CLDC 28 3.4.4 Software requirements of MIDP 29 3.4.5 J2ME requirements 30 3.5 Scope of the CLDC and MIDP Standardization Efforts 30 3.5.1 Scope of CLDC 30 3.5.2 Scope of MIDP 31 4 High-Level Architecture and Security 35 4.1 High-Level Architecture 35 4.2 Security 37 4.2.1 Low-level (virtual machine) security 38 4.2.2 Application-level security 39 4.2.3 End-to-end security 41 5 Connected Limited Device Configuration 43 5.1 CLDC Expert Group 44 5.2 CLDC Application Model 44 5.2.1 Architectural overview 44 5.2.2 The concept of a Java application 45 5.2.3 Application management 46 5.3 Java Language Specification Compatibility 47 5.3.1 No floating point support 47 5.3.2 No finalization 48 5.3.3 Error handling limitations 48 5.4 Java Virtual Machine Specification Compatibility 48 5.4.1 No floating point support 49 5.4.2 Other differences 50 5.4.3 Class file verification 53 5.4.4 Class file format and class loading 55 6 CLDC Libraries 59 6.1 Background and Goals 59 6.2 Classes Derived from J2SE 60 6.2.1 System classes 60 6.2.2 Data type classes 61 6.2.3 Collection classes 61 6.2.4 Input/output classes 61 6.2.5 Calendar and time classes 62 6.2.6 Additional classes 62

6.2.7 Exception and error classes 62 6.2.8 Internationalization support 63 6.2.9 Property support 64 6.3 CLDC-Specific Classes 65 6.3.1 Background and motivation 65 6.3.2 The Generic Connection framework 66 6.3.3 No network protocol implementations defined in CLDC.. 68 6.3.4 Design of the Generic Connection framework 68 6.3.5 Additional remarks 71 6.3.6 Sample code 71 7 Mobile Information Device Profile 79 7.1 MIDP Expert Group 80 7.2 Areas Covered by the MIDP Specification 80 8 MIDP Application Model 83 8.1 Limitations of the CLDC Application Model 83 8.2 MIDlets 85 8.2.1 MIDlet states 89 8.3 MIDlet Suites 92 8.3.1 MIDlet suite packaging 92 8.3.2 MIDlet suite execution environment 96 8.4 MIDP System Software 98 8.4.1 Application management functionality 98 9 MIDP User Interface Libraries 101 9.1 Structure of the MIDP User Interface API 102 9.1.1 Screen model 102 9.1.2 Low-level user interface 104 9.1.3 High-level user interface 104 9.2 Abstract Commands 105 9.2.1 Commands and command types 105 9.2.2 Command listeners 106 9.3 Interactions with MIDlet Application Lifecycle 106 9.4 Graphics and Canvas in the Low-Level API 107 9.4.1 Redrawing mechanism 108 9.4.2 Drawing model 108 9.4.3 Coordinate system 109 9.4.4 Clipping and translation 110 9.4.5 Color model 110

CONTENTS 9.4.6 Line styles Ill 9.4.7 Fonts Ill 9.4.8 Canvas visibility 112 9.5 Low-level API for Events in Canvases 112 9.5.1 Key events 112 9.5.2 Action keys 112 9.5.3 Pointer events 113 9.6 Graphics Drawing Primitives 113 9.6.1 Scaling to the Canvas 113 9.6.2 Drawing lines 114 9.6.3 Drawing and filling arcs 115 9.6.4 Drawing and filling rectangles 115 9.6.5 Drawing and filling rounded rectangles 116 9.6.6 Drawing text and images 117 9.7 Creating and Using Images 118 9.7.1 Mutable and immutable images 118 9.7.2 Drawing to a mutable image 119 9.7.3 Animation using images 119 9.8 Using Screens 124 9.8.1 List 124 9.8.2 TextBox 127 9.8.3 Alert 128 9.8.4 Ticker 129 9.8.5 Form 130 9.9 Using Items 130 9.9.1 Item 130 9.9.2 String and Stringltem 131 9.9.3 Image and Imageltem 131 9.9.4 TextField 131 9.9.5 DateField 132 9.9.6 ChoiceGroup 132 9.9.7 Gauge 133 9.9.8 ItemStateListener 133 9.10 A Note on Concurrency 133 10 MIDP Networking Libraries 135 10.1 Characteristics of Wireless Data Networks 135 10.2 Network Interface Considerations 136 10.3 The HttpConnection Interface 138

10.3.1 States of a network connection 138 10.3.2 Parsing URLs 139 10.3.3 Establishing a connection 140 10.3.4 HTTP request headers 140 10.3.5 Using an HTTP connection 141 10.3.6 HTTP response headers 143 10.4 Sample Code (NetClientMIDlet.java) 145 11 MIDP Persistence Libraries 157 11.1 The Record Management System 157 11.2 Manipulating Record Stores and Records 158 11.2.1 Manipulating a record store 159 11.2.2 Manipulating records in a record store 161 11.2.3 Converting record data to and from byte arrays 161 11.2.4 Filtering, comparing, listening and enumerating records.162 11.3 Sample Code (RMSMIDlet.java) 166 12 Additional MIDP APIs 177 12.1 Timer Support 177 12.1.1 Using one-shot timers 178 12.1.2 Using repeating timers 178 12.1.3 Sample code (TimerMIDlet.java) 179 12.2 System Properties 183 12.3 Application Resource Files 184 12.4 Exiting a MIDlet 184 13 Sample Applications 187 13.1 The PhotoAlbum Application 188 13.1.1 Class PhotoAlbum 190 13.1.2 Class PhotoFrame 195 13.1.3 Class Animation 205 13.1.4 Descriptor file PhotoAlbum.jad 210 13.2 The AddressBook Application 211 13.2.1 Class AddressBookMIDlet 211 13.2.2 Class SimpleRecord 225 13.2.3 Class SimpleFilter 227 13.2.4 Class SimpleComparator 229 13.2.5 Class NetworkQuery 231 13.3 The Sokoban Game Application 237 13.3.1 Class Sokoban 237

CONTENTS 13.3.2 Class SokoCanvas 241 13.3.3 Class Board 252 13.3.4 Class Score 259 13.4 Development Environments for J2ME 265 14 Summary 267 Appendix A: CLDC Application Programming Interface 271 Almanac Legend 274 java.lang 277 java.io 291 java.util 299 javax.microedition.io 305 Appendix B: MIDP Application Programming Interface 309 java.lang 311 java.util 313 javax.microedition.io 315 javax.microedition.lcdui 317 javax.microedition.midlet 329 javax.microedition.rms 331 Index 335