did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780321743015

Android Wireless Application Development

by ;
  • ISBN13:

    9780321743015

  • ISBN10:

    0321743016

  • Edition: 2nd
  • Format: Paperback
  • Copyright: 2010-12-15
  • Publisher: Addison-Wesley Professional
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $49.99 Save up to $5.00
  • Digital
    $44.99
    Add to Cart

    DURATION
    PRICE

Supplemental Materials

What is included with this book?

Summary

The complete, start-to-finish guide to Android development -- from concept to market -- completely updated for the latest Android SDK! bull; bull;At least one market research firm has predicted that by 2012 there will be more Android phones than iPhones. bull;Covers application design, development, debugging, packaging, distribution, and much more. bull;Includes invaluable real-world tips from experienced mobile developers. bull;This book covers multiple Android SDK versions, which is how developers must work with Android. Android is rapidly gaining traction as an exciting alternative to Apple's iPhone platform, and thousands of developers are eagerly seeking the information they need to begin creating Android applications. Drawing on their experience in mobile and wireless software development, the authors walk through the entire process of developing successful Android applications, from concept through coding, testing through distribution. The only book developers will need, Android Wireless Application Development 2/e is the comprehensive resource for developers who are new to Android - or to wireless development in general. Conder and Darcey cover: bull; bull;Mastering the Android development environment. bull;Understanding the entire Android application lifecycle. bull;Building effective user interfaces. bull;Using Android's APIs for networking, location-based services, data, storage, multimedia, telephony, graphics, and more bull;Working with Android's optional hardware-specific APIs bull;Designing more effective applications using Notifications and Services bull;Developing and testing bulletproof Android applications The book also provides valuable appendices on Android's Emulator, DDMS, Debug Bridge, and SQLite database, as well as a convenient glossary that demystifies the terminology of mobile development.

Author Biography

Lauren Darcey is responsible for the technical leadership and direction of a small software company specializing in mobile technologies, including Android, iPhone, Blackberry, Palm Pre,BREW, and J2ME and consulting services.With more than two decades of experience in professional software production, Lauren is a recognized authority in application architecture and the development of commercial-grade mobile applications. Lauren received a B.S. in Computer Science from the University of California, Santa Cruz.

 

She spends her copious free time traveling the world with her geeky mobile-minded husband and is an avid nature photographer. Her work has been published in books and newspapers around the world. In South Africa, she dove with 4-meter-long great white sharks and got stuck between a herd of rampaging hippopotami and an irritated bull elephant. She’s been attacked by monkeys in Japan, gotten stuck in a ravine with two hungry lions in Kenya, gotten thirsty in Egypt, narrowly avoided a coup d’état in Thailand, geocached her way through the Swiss Alps, drank her way through the beer halls of Germany, slept in the crumbling castles of Europe, and gotten her tongue stuck to an iceberg in Iceland (while being watched by a herd of suspicious wild reindeer).

 

Shane Conder has extensive development experience and has focused his attention on mobile and embedded development for the past decade. He has designed and developed many commercial applications for Android, iPhone,BREW, Blackberry, J2ME, Palm, and Windows Mobile—some of which have been installed on millions of phones worldwide. Shane has written extensively about the mobile industry and evaluated mobile development platforms on his tech blogs and is well known within the blogosphere. Shane received a B.S. in Computer Science from the University of California.

 

A self-admitted gadget freak, Shane always has the latest phone, laptop, or other mobile device.He can often be found fiddling with the latest technologies, such as cloud services and mobile platforms, and other exciting, state-of-the-art technologies that activate the creative part of his brain. He also enjoys traveling the world with his geeky wife, even if she did make him dive with 4-meter-long great white sharks and almost get eaten by a lion in Kenya. He admits that he has to take at least two phones with him when backpacking—even though there is no coverage—that he snickered and whipped out his Android phone to take a picture when Laurie got her tongue stuck to that iceberg in Iceland, and that he is catching on that he should be writing his own bio.

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

 

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program