Home > Store

Android Wireless Application Development, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Android Wireless Application Development, 2nd Edition


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2011
  • Edition: 2nd
  • Book
  • ISBN-10: 0-321-74301-6
  • ISBN-13: 978-0-321-74301-5

The start-to-finish guide to Android application development: massively updated for the newest SDKs and developer techniques!

This book delivers all the up-to-date information, tested code, and best practices you need to create and market successful mobile apps with the latest versions of Android. Drawing on their extensive experience with mobile and wireless development, Lauren Darcey and Shane Conder cover every step: concept, design, coding, testing, packaging, and delivery. The authors introduce the Android platform, explain the principles of effective Android application design, and present today’s best practices for crafting effective user interfaces. Next, they offer detailed coverage of each key Android API, including data storage, networking, telephony, location-based services, multimedia, 3D graphics, and hardware.

Every chapter of this edition has been updated for the newest Android SDKs, tools, utilities, and hardware. All sample code has been overhauled and tested on leading devices from multiple companies, including HTC, Motorola, and ARCHOS. Many new examples have been added, including complete new applications. This new edition also adds

  • Nine new chapters covering web APIs, the Android NDK, extending application reach, managing users, data synchronization, backups, advanced user input, and more
  • Greatly expanded coverage of Android manifest files, content providers, app design, and testing
  • New coverage of hot topics like Bluetooth, gestures, voice recognition, App Widgets, live folders, live wallpapers, and global search
  • Updated 3D graphics programming coverage reflecting OpenGL ES 2.0
  • An all-new chapter on tackling cross-device compatibility issues, from designing for the smallest phones to the big new tablets hitting the market
  • Even more tips and tricks to help you design, develop, and test applications for different devices
  • A new appendix full of Eclipse tips and tricks

This book is an indispensable resource for every member of the Android development team: software developers with all levels of mobile experience, team leaders and project managers, testers and QA specialists, software architects, and even marketers.

Sample Content

Online Sample Chapter

Introducing Android Wireless Application Development

Sample Pages

Download the sample pages (includes Chapter 1 and Index)

Table of Contents

Introduction 1

Part I: An Overview of Android

Chapter 1 Introducing Android 7

A Brief History of Mobile Software Development 7

    Way Back When 7

     “The Brick” 9

    Wireless Application Protocol (WAP) 11

    Proprietary Mobile Platforms 13

The Open Handset Alliance 15

    Google Goes Wireless 15

    Forming the Open Handset Alliance 15

    Manufacturers: Designing the Android Handsets 16

    Mobile Operators: Delivering the Android Experience 17

    Content Providers: Developing Android Applications 17

    Taking Advantage of All Android Has to Offer 18

Android Platform Differences 18

    Android: A Next-Generation Platform 18

    Free and Open Source 20

    Familiar and Inexpensive Development Tools 20

    Reasonable Learning Curve for Developers 20

    Enabling Development of Powerful Applications 21

    Rich, Secure Application Integration 21

    No Costly Obstacles to Publication 21

    A “Free Market” for Applications 22

    A New and Growing Platform 22

The Android Platform 23

    Android’s Underlying Architecture 23

    Security and Permissions 25

    Developing Android Applications 26

Summary 28

References and More Information 28

Chapter 2 Setting Up Your Android Development Environment 29

Configuring Your Development Environment 29

    Configuring Your Operating System for Device Debugging 30

    Configuring Your Android Hardware for Debugging 30

    Upgrading the Android SDK 31

    Problems with the Android Software Development Kit 32

Exploring the Android SDK 32

    Understanding the Android SDK License Agreement 32

    Reading the Android SDK Documentation 33

    Exploring the Android Application Framework 35

    Getting to Know the Android Tools 35

    Exploring the Android Sample Applications 40

Summary 41

References and More Information 41

Chapter 3 Writing Your First Android Application 43

Testing Your Development Environment 43

    Adding the Snake Application to a Project in Your Eclipse Workspace 43

    Creating an Android Virtual Device (AVD) for Your Snake Project 44

    Creating a Launch Configuration for Your Snake Project 46

    Running the Snake Application in the Android Emulator 47

Building Your First Android Application 48

    Creating and Configuring a New Android Project 50

    Core Files and Directories of the Android Application 50

    Creating an AVD for Your Project 51

    Creating Launch Configurations for Your Project 52

    Running Your Android Application in the Emulator 53

    Debugging Your Android Application in the Emulator 56

    Adding Logging Support to Your Android Application 59

    Adding Some Media Support to Your Application 60

    Adding Location-Based Services to Your Application 62

    Debugging Your Application on the Hardware 65

Summary 66

References and More Information 67

Part II: Android Application Design Essentials

Chapter 4 Understanding the Anatomy of an Android Application 69

Mastering Important Android Terminology 69

Using the Application Context 70

    Retrieving the Application Context 70

    Using the Application Context 70

Performing Application Tasks with Activities 71

    The Lifecycle of an Android Activity 72

    Managing Activity Transitions with Intents 76

Working with Services 78

Receiving and Broadcasting Intents 79

Summary 80

References and More Information 80

Chapter 5 Defining Your Application Using the Android Manifest File 81

Configuring the Android Manifest File 81

    Editing the Android Manifest File 82

Managing Your Application’s Identity 86

    Versioning Your Application 86

    Setting the Application Name and Icon 87

Enforcing Application System Requirements 87

    Targeting Specific SDK Versions 87

    Enforcing Application Platform Requirements 90

    Working with External Libraries 92

Registering Activities and Other Application Components 92

    Designating a Primary Entry Point Activity for Your Application Using an Intent Filter 92

    Configuring Other Intent Filters 93

Working with Permissions 94

    Registering Permissions Your Application Requires 94

    Registering Permissions Your Application Grants to Other Applications 95

Exploring Other Manifest File Settings 96

Summary 96

References and More Information 96

Chapter 6 Managing Application Resources 97

What Are Resources? 97

    Storing Application Resources 97

    Understanding the Resource Directory Hierarchy 97

    Resource Value Types 99

    Storing Different Resource Value Types 101

    Accessing Resources Programmatically 103

Setting Simple Resource Values Using Eclipse 104

Working with Resources 107

    Working with String Resources 107

    Using String Resources as Format Strings 108

    Working with String Arrays 109

    Working with Boolean Resources 110

    Working with Integer Resources 111

    Working with Colors 111

    Working with Dimensions 112

    Working with Simple Drawables 113

    Working with Images 114

    Working with Animation 116

    Working with Menus 119

    Working with XML Files 120

    Working with Raw Files 121

    References to Resources 122

    Working with Layouts 123

    Working with Styles 127

    Working with Themes 131

Referencing System Resources 131

Summary 132

References and More Information 132

Part III: Android User Interface Design Essentials

Chapter 7 Exploring User Interface Screen Elements 133

Introducing Android Views and Layouts 133

    Introducing the Android View 133

    Introducing the Android Control 133

    Introducing the Android Layout 134

Displaying Text to Users with TextView 134

    Configuring Layout and Sizing 135

    Creating Contextual Links in Text 136

Retrieving Data from Users 137

    Retrieving Text Input Using EditText Controls 138

    Giving Users Input Choices Using Spinner Controls 142

Using Buttons, Check Boxes, and Radio Groups 144

    Using Basic Buttons 144

    Using Check Boxes and Toggle Buttons 146

    Using RadioGroups and RadioButtons 147

Getting Dates and Times from Users 150

Using Indicators to Display Data to Users 151

    Indicating Progress with ProgressBar 151

Adjusting Progress with SeekBar 153

    Displaying Rating Data with RatingBar 154

    Showing Time Passage with the Chronometer 155

    Displaying the Time 156

Providing Users with Options and Context Menus 157

    Enabling the Options Menu 157

    Enabling the ContextMenu 159

Handling User Events 161

    Listening for Touch Mode Changes 161

    Listening for Events on the Entire Screen 162

    Listening for Long Clicks 163

    Listening for Focus Changes 164

Working with Dialogs 165

    Exploring the Different Types of Dialogs 165

    Tracing the Lifecycle of a Dialog 166

    Working with Custom Dialogs 168

Working with Styles 168

Working with Themes 170

Summary 171

Chapter 8 Designing User Interfaces with Layouts 173

Creating User Interfaces in Android 173

    Creating Layouts Using XML Resources 173

    Creating Layouts Programmatically 175

Organizing Your User Interface 177

    Understanding View versus ViewGroup 178

Using Built-In Layout Classes 181

    Using FrameLayout 183

    Using LinearLayout 185

    Using RelativeLayout 186

    Using TableLayout 190

    Using Multiple Layouts on a Screen 192

Using Built-In View Container Classes 192

    Using Data-Driven Containers 194

    Organizing Screens with Tabs 198

    Adding Scrolling Support 201

    Exploring Other View Containers 202

Summary 203

Chapter 9 Drawing and Working with Animation 205

Drawing on the Screen 205

    Working with Canvases and Paints 205

Working with Text 210

    Using Default Fonts and Typefaces 210

    Using Custom Typefaces 211

    Measuring Text Screen Requirements 212

Working with Bitmaps 212

    Drawing Bitmap Graphics on a Canvas 213

    Scaling Bitmap Graphics 213

    Transforming Bitmaps Using Matrixes 213

Working with Shapes 214

    Defining Shape Drawables as XML Resources 214

    Defining Shape Drawables Programmatically 215

    Drawing Different Shapes 215

Working with Animation 221

    Working with Frame-by-Frame Animation 223

    Working with Tweened Animations 224

Summary 230

Part IV: Using Common Android APIs

Chapter 10 Using Android Data and Storage APIs 231

Working with Application Preferences 231

    Creating Private and Shared Preferences 232

    Searching and Reading Preferences 232

    Adding, Updating, and Deleting Preferences 233

    Finding Preferences Data on the Android File System 234

Working with Files and Directories 235

    Exploring with the Android Application Directories 235

    Working with Other Directories and Files on the Android File System 238

Storing Structured Data Using SQLite Databases 239

    Creating a SQLite Database 240

    Creating, Updating, and Deleting Database Records 242

    Querying SQLite Databases 244

    Closing and Deleting a SQLite Database 250

    Designing Persistent Databases 250

    Binding Data to the Application User Interface 253

Summary 257

References and More Information 258

Chapter 11 Sharing Data Between Applications with Content Providers 259

Exploring Android’s Content Providers 259

    Using the MediaStore Content Provider 260

    Using the CallLog Content Provider 261

    Using the Browser Content Provider 263

    Using the Contacts Content Provider 264

    Using the UserDictionary Content Provider 267

    Using the Settings Content Provider 267

Modifying Content Providers Data 267

    Adding Records 267

    Updating Records 268

    Deleting Records 269

Enhancing Applications Using Content Providers 269

    Accessing Images on the Device 270

Acting as a Content Provider 274

    Implementing a Content Provider Interface 275

    Defining the Data URI 276

    Defining Data Columns 276

    Implementing Important Content Provider Methods 276

    Updating the Manifest File 282

Working with Live Folders 282

Summary 285

References and More Information 285

Chapter 12 Using Android Networking APIs 287

Understanding Mobile Networking Fundamentals 287

Accessing the Internet (HTTP) 288

    Reading Data from the Web 288

    Using HttpURLConnection 289

    Parsing XML from the Network 290

    Processing Asynchronously 291

    Working with AsyncTask 292

    Using Threads for Network Calls 293

    Displaying Images from a Network Resource 295

    Retrieving Android Network Status 297

Summary 298

References and More Information 299

Chapter 13 Using Android Web APIs 301

Browsing the Web with WebView 301

    Designing a Layout with a WebView Control 302

    Loading Content into a WebView Control 302

    Adding Features to the WebView Control 304

Building Web Extensions Using WebKit 307

    Browsing the WebKit APIs 307

    Extending Web Application Functionality to Android 308

Working with Flash 311

    Enabling Flash Applications 312

    Building AIR Applications for Android 313

Summary 314

References and More Information 314

Chapter 14 Using Location-Based Services (LBS) APIs 315

Using Global Positioning Services (GPS) 315

    Using GPS Features in Your Applications 316

    Finding Your Location 316

    Locating Your Emulator 318

Geocoding Locations 318

Mapping Locations 322

    Mapping Intents 322

    Mapping Views 322

    Getting Your Debug API Key 325

    Panning the Map View 326

    Zooming the Map View 327

    Marking the Spot 327

Doing More with Location-Based Services 332

Summary 333

References and More Information 333

Chapter 15 Using Android Multimedia APIs 335

Working with Multimedia 335

Working with Still Images 336

    Capturing Still Images Using the Camera 336

    Configuring Camera Mode Settings 340

    Sharing Images 341

    Assigning Images as Wallpapers 342

Working with Video 343

    Recording Video 343

    Playing Video 345

Working with Audio 346

    Recording Audio 347

    Playing Audio 348

    Sharing Audio 349

    Searching for Multimedia 350

    Working with Ringtones 351

Summary 351

References and More Information 351

Chapter 16 Using Android Telephony APIs 353

Working with Telephony Utilities 353

    Gaining Permission to Access Phone State Information 354

    Requesting Call State 354

    Requesting Service Information 356

    Monitoring Signal Strength and Data Connection Speed 356

    Working with Phone Numbers 357

Using SMS 357

    Gaining Permission to Send and Receive SMS Messages 358

    Sending an SMS 358

    Receiving an SMS 360

Making and Receiving Phone Calls 362

    Making Phone Calls 362

    Receiving Phone Calls 364

Summary 365

References and More Information 365

Chapter 17 Using Android 3D Graphics with OpenGL ES 367

Working with OpenGL ES 367

    Leveraging OpenGL ES in Android 368

    Ensuring Device Compatibility 368

Using OpenGL ES APIs in the Android SDK 369

Handling OpenGL ES Tasks Manually 369

    Creating a SurfaceView 370

    Starting Your OpenGL ES Thread 371

    Initializing EGL 373

    Initializing GL 374

    Drawing on the Screen 375

Drawing 3D Objects 376

    Drawing Your Vertices 376

    Coloring Your Vertices 377

    Drawing More Complex Objects 378

    Lighting Your Scene 379

    Texturing Your Objects 381

Interacting with Android Views and Events 383

    Enabling the OpenGL Thread to Talk to the Application Thread 384

    Enabling the Application Thread to Talk to the OpenGL Thread 386

Cleaning Up OpenGL ES 387

Using GLSurfaceView (Easy OpenGL ES) 388

Using OpenGL ES 2.0 391

    Configuring Your Application for OpenGL ES 2.0 391

    Requesting an OpenGL ES 2.0 Surface 391

Summary 395

References and More Information 396

Chapter 18 Using the Android NDK 397

Determining When to Use the Android NDK 397

Installing the Android NDK 398

Exploring the Android NDK 398

    Running an Android NDK Sample Application 399

Creating Your Own NDK Project 399

    Calling Native Code from Java 400

    Handling Parameters and Return Values 401

    Using Exceptions with Native Code 402

Improving Graphics Performance 403

Summary 405

References and More Information 405

Chapter 19 Using Android’s Optional Hardware APIs 407

Interacting with Device Hardware 407

Using the Device Sensor 408

    Working with Different Sensors 408

    Acquiring Access to a Sensor 409

    Reading Sensor Data 409

    Calibrating Sensors 410

    Determining Device Orientation 411

    Finding True North 412

Working with Wi-Fi 412

Working with Bluetooth 414

    Checking for the Existence of Bluetooth Hardware 415

    Enabling Bluetooth 415

    Querying for Paired Devices 416

    Discovering Devices 416

    Establishing Connections Between Devices 416

Monitoring the Battery 417

Summary 420

References and More Information 421

Part V: More Android Application Design Principles

Chapter 20 Working with Notifications 423

Notifying the User 423

Notifying with the Status Bar 424

    Using the NotificationManager Service 425

    Creating a Simple Text Notification with an Icon 425

    Working with the Notification Queue 426

    Updating Notifications 427

    Clearing Notifications 428

Vibrating the Phone 429

Blinking the Lights 430

Making Noise 431

Customizing the Notification 432

Designing Useful Notifications 434

Summary 434

References and More Information 435

Chapter 21 Working with Services 437

Determining When to Use Services 437

Understanding the Service Lifecycle 438

Creating a Service 438

Controlling a Service 443

Implementing a Remote Interface 444

Implementing a Parcelable Class 446

Summary 449

References and More Information 449

Chapter 22 Extending Android Application Reach 451

Enhancing Your Applications 451

Working with App Widgets 452

    Creating an App Widget 453

    Installing an App Widget 460

    Becoming an App Widget Host 460

Working with Live Wallpapers 461

    Creating a Live Wallpaper 462

    Installing a Live Wallpaper 465

Acting as a Content Type Handler 466

Determining Intent Actions and MIME Types 467

    Implementing the Activity to Process the Intents 468

    Registering the Intent Filter 469

Making Application Content Searchable 469

    Enabling Searches Within Your Application 470

    Enabling Global Search 478

Working with Live Folders 480

    Creating Live Folders 481

    Installing a Live Folder 485

Summary 487

References and More Information 487

Chapter 23 Managing User Accounts and Synchronizing User Data 489

Managing Accounts with the Account Manager 489

    Synchronizing Data with Sync Adapters 490

Using Backup Services 491

    Choosing a Remote Backup Service 492

    Implementing a Backup Agent 492

    Backing Up and Restoring Application Data 496

Summary 497

References and More Information 497

Chapter 24 Handling Advanced User Input 499

Working with Textual Input Methods 499

    Working with Software Keyboards 499

    Working with Text Prediction and User Dictionaries 502

Exploring the Accessibility Framework 502

    Leveraging Speech Recognition Services 503

    Leveraging Text-To-Speech Services 506

Working with Gestures 508

    Detecting User Motions Within a View 509

Handling Common Single-Touch Gestures 509

    Handling Common Multi-Touch Gestures 516

    Making Gestures Look Natural 518

Working with the Trackball 519

Handling Screen Orientation Changes 519

Summary 522

References and More Information 522

Chapter 25 Targeting Different Device Configurations and Languages 523

Maximizing Application Compatibility 523

Designing User Interfaces for Compatibility 525

    Supporting Specific Screen Types 526

    Working with Nine-Patch Stretchable Graphics 526

    Using the Working Square Principle 528

Providing Alternative Application Resources 531

    Working with Alternative Resource Qualifiers 531

    Providing Resources for Different Orientations 537

    Using Alternative Resources Programmatically 538

    Organizing Application Resources Efficiently 538

Internationalizing Applications 539

    Internationalization Using Alternative Resources 540

    Implementing Locale Support Programmatically 544

Targeting Different Device Configurations 545

    Supporting Hardware Configurations 545

    Targeting Different Android SDK Versions 546

Summary 548

References and More Information 549

Part VI: Deploying Your Android Application to the World

Chapter 26 The Mobile Software Development Process 551

An Overview of the Mobile Development Process 551

Choosing a Software Methodology 552

    Understanding the Dangers of Waterfall Approaches 552

    Understanding the Value of Iteration 553

Gathering Application Requirements 553

    Determining Project Requirements 553

    Developing Use Cases for Mobile Applications 555

    Incorporating Third-Party Requirements 555

    Managing a Device Database 555

Assessing Project Risks 558

    Identifying Target Devices 558

    Acquiring Target Devices 560

    Determining Feasibility of Application Requirements 561

    Understanding Quality Assurance Risks 561

Writing Essential Project Documentation 562

    Developing Test Plans for Quality Assurance Purposes 562

    Providing Documentation Required by Third Parties 563

    Providing Documentation for Maintenance and Porting 563

Leveraging Configuration Management Systems 563

    Choosing a Source Control System 563

    Implementing an Application Version System That Works 564

Designing Mobile Applications 564

    Understanding Mobile Device Limitations 564

    Exploring Common Mobile Application Architectures 564

    Designing for Extensibility and Maintenance 565

    Designing for Application Interoperability 566

Developing Mobile Applications 567

Testing Mobile Applications 567

Deploying Mobile Applications 568

    Determining Target Markets 568

Supporting and Maintaining Mobile Applications 568

    Track and Address Crashes Reported by Users 569

    Testing Firmware Upgrades 569

    Maintaining Adequate Application Documentation 569

    Managing Live Server Changes 569

    Identifying Low-Risk Porting Opportunities 569

Summary 570

References and More Information 570

Chapter 27 Designing and Developing Bulletproof Android Applications 571

Best Practices in Designing Bulletproof Mobile Applications 571

    Meeting Mobile Users’ Demands 572

    Designing User Interfaces for Mobile Devices 572

    Designing Stable and Responsive Mobile Applications 573

    Designing Secure Mobile Applications 574

    Designing Mobile Applications for Maximum Profit 575

    Leveraging Third-Party Standards for Android Application Design 576

    Designing Mobile Applications for Ease of Maintenance and Upgrades 576

    Leveraging Android Tools for Application Design 578

Avoiding Silly Mistakes in Android Application Design 578

Best Practices in Developing Bulletproof Mobile Applications 579

    Designing a Development Process That Works for Mobile Development 579

    Testing the Feasibility of Your Application Early and Often 579

    Using Coding Standards, Reviews, and Unit Tests to Improve Code Quality 580

    Handling Defects Occurring on a Single Device 582

    Leveraging Android Tools for Development 583

    Avoiding Silly Mistakes in Android Application Development 583

Summary 583

References and More Information 584

Chapter 28 Testing Android Applications 585

Best Practices in Testing Mobile Applications 585

    Designing a Mobile Application Defect Tracking System 585

    Managing the Testing Environment 587

    Maximizing Testing Coverage 589

    Leveraging Android Tools for Android Application Testing 595

    Avoiding Silly Mistakes in Android Application Testing 595

    Outsourcing Testing Responsibilities 596

Summary 596

References and More Information 596

Chapter 29 Selling Your Android Application 597

Choosing the Right Distribution Model 597

Packaging Your Application for Publication 598

    Preparing Your Code to Package 599

    Packing and Signing Your Application 600

    Testing the Release Version of Your

    Application Package 603

    Certifying Your Android Application 603

Distributing Your Applications 603

    Selling Your Application on the Android Market 603

    Selling Your Application on Your Own Server 609

    Selling Your Application Using Other Alternatives 610

    Protecting Your Intellectual Property 611

    Billing the User 611

Summary 612

References and More Information 612

Part VII: Appendixes

Appendix A The Android Emulator Quick-Start Guide 613

Simulating Reality: The Emulator’s Purpose 613

Working with Android Virtual Devices (AVDs) 615

    Using the Android SDK and AVD Manager 616

    Creating an AVD 616

Launching the Emulator with a Specific AVD 620

    Configuring Emulator Startup Options 621

    Launching an Emulator to Run an Application 621

    Launching an Emulator from the Android SDK and AVD Manager 623

Configuring the GPS Location of the Emulator 623

Calling Between Two Emulator Instances 625

Messaging Between Two Emulator Instances 625

Interacting with the Emulator Through the Console 628

    Using the Console to Simulate Incoming Calls 628

    Using the Console to Simulate SMS Messages 629

    Using the Console to Send GPS Coordinates 630

    Using the Console to Monitor Network Status 631

    Using the Console to Manipulate Power Settings 631

    Using Other Console Commands 632

Enjoying the Emulator 632

Understanding Emulator Limitations 632

Appendix B The Android DDMS Quick-Start Guide 635

Using DDMS with Eclipse and as a Stand-Alone Application 635

Getting Up to Speed Using Key Features of DDMS 636

Working with Processes 637

    Attaching a Debugger to an Android Application 638

    Monitoring Thread Activity of an Android Application 638

    Prompting Garbage Collection (GC) 639

    Monitoring Heap Activity 639

    Monitoring Memory Allocation 640

    Stopping a Process 640

Working with the File Explorer 641

    Browsing the File System of an Emulator or Device 641

    Copying Files from the Emulator or Device 641

    Copying Files to the Emulator or Device 642

    Deleting Files on the Emulator or Device 642

Working with the Emulator Control 642

    Simulating Incoming Voice Calls 643

    Simulating Incoming SMS Messages 643

    Sending a Location Fix 643

Working with Application Logging 644

Taking Screen Captures of Emulator and Device Screens 645

Appendix C The Android Debug Bridge Quick-Start Guide 647

Listing Connected Devices and Emulators 647

Directing ADB Commands to Specific Devices 648

Starting and Stopping the ADB Server 648

    Stopping the ADB Server Process 648

    Starting and Checking the ADB Server Process 648

Issuing Shell Commands 649

    Issuing a Single Shell Command 649

    Using a Shell Session 649

    Using the Shell to Start and Stop the Emulator 649

Copying Files 650

    Sending Files to a Device or Emulator 650

    Retrieving Files from a Device or Emulator 650

Installing and Uninstalling Applications 651

    Installing Applications 651

    Reinstalling Applications 651

    Uninstalling Applications 651

Working with LogCat Logging 652

    Displaying All Log Information 652

    Including Date and Time with Log Data 652

    Filtering Log Information 652

    Clearing the Log 654

    Redirecting Log Output to a File 654

    Accessing the Secondary Logs 654

Controlling the Backup Service 654

    Forcing Backup Operations 655

    Forcing Restore Operations 655

    Wiping Archived Data 655

Generating Bug Reports 655

Using the Shell to Inspect SQLite Databases 656

Using the Shell to Stress Test Applications 656

    Letting the Monkey Loose on Your Application 656

    Listening to Your Monkey 656

    Directing Your Monkey’s Actions 657

    Training Your Monkey to Repeat His Tricks 658

    Keeping the Monkey on a Leash 658

    Learning More About Your Monkey 659

Installing Custom Binaries via the Shell 659

Exploring Other ADB Commands 660

Appendix D Eclipse IDE Tips and Tricks 661

Organizing Your Eclipse Workspace 661

    Integrating with Source Control Services 661

    Repositioning Tabs Within Perspectives 661

    Maximizing Windows 662

    Minimizing Windows 662

    Viewing Windows Side by Side 662

    Viewing Two Sections of the Same File 662

    Closing Unwanted Tabs 662

    Keeping Windows Under Control 663

    Creating Custom Log Filters 663

Writing Code in Java 663

    Using Auto-Complete 664

    Formatting Code 664

    Creating New Classes 664

    Creating New Methods 664

    Organizing Imports 664

    Renaming Almost Anything 665

    Refactoring Code 665

    Reorganizing Code 667

    Providing Javadoc-Style Documentation 667

    Resolving Mysterious Build Errors 667

Appendix E The SQLite Quick-Start Guide 669

Exploring Common Tasks with SQLite 669

Using the sqlite3 Command-Line Interface 670

    Launching the ADB Shell 670

    Connecting to a SQLite Database 670

    Exploring Your Database 671

    Importing and Exporting the Database and Its Data 672

    Executing SQL Commands on the Command Line 674

    Using Other sqlite3 Commands 675

    Understanding SQLite Limitations 675

Learning by Example: A Student Grade Database 675

    Designing the Student Grade Database Schema 676

    Creating Simple Tables with AUTOINCREMENT 676

    Inserting Data into Tables 677

    Querying Tables for Results with SELECT 677

    Using Foreign Keys and Composite Primary Keys 678

    Altering and Updating Data in Tables 679

    Querying Multiple Tables Using JOIN 680

    Using Calculated Columns 680

    Using Subqueries for Calculated Columns 682

    Deleting Tables 682

9780321743015   TOC   11/19/2010


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020