SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Bonus KitKat material is available for download at www.informit.com/title/
What Every Android™ App Developer Should Know Today: Android Tools, App/UI Design, Testing, Publishing, And More
This fully reworked edition of a proven title is the most useful real-world guide to building robust, commercial-grade Android™ apps. The content is revised and updated for the latest Android 4.3 SDK and the newest development best practices. Introduction to Android™ Application Development: Android Essentials, Fourth Edition,covers all you need to quickly start developing professional apps for today’s Android devices. Three expert developers guide you through setting up your development environment, designing user interfaces, developing for diverse devices, and optimizing your entire app-development process–from design through publication. Updated throughout, this title includes extensive coverage of the most useful new Android tools and utilities. It adds an all-new chapter on planning an amazing Android app user experience, plus extensive new coverage of unit testing, dialogs, preferences, and app publishing. Throughout, key concepts are taught through clear, up-to-date example code.
This edition offers
For Android developers at all levels of experience, this reference is now more valuable than ever. Students, instructors, and self-learners will especially appreciate new chapter-ending questions and exercises, carefully designed to test knowledge and deepen mastery.
Annuzzi has released new source code samples for use with Android Studio. The code updates are posted to the associated blog site: http://
Note: This revamped, newly titled edition is a complete update of Android™ Wireless Application Development, Volume I: Android Essentials, Third Edition
Download free additional content from Introduction to Android Application Development: Android Essentials here and here
Writing Your First Android Application
Download the sample pages (includes Chapter 3 and Index)
Acknowledgments xxxi
About the Authors xxxiii
Introduction 1
Who Should Read This Book 1
Key Questions Answered in This Book 2
How This Book Is Structured 2
An Overview of Changes in This Edition 3
Development Environments Used in This Book 5
Supplementary Materials Available 6
Where to Find More Information 6
Conventions Used in This Book 7
Contacting the Authors 7
Part I: An Overview of the Android Platform
Chapter 1: Introducing Android 11
A Brief History of Mobile Software Development 11
The Open Handset Alliance 18
Android Platform Differences 23
The Android Platform 29
Summary 36
Quiz Questions 36
Exercises 36
References and More Information 36
Chapter 2: Setting Up Your Android Development Environment 37
Configuring Your Development Environment 37
Exploring the Android SDK 43
Summary 52
Quiz Questions 52
Exercises 53
References and More Information 53
Chapter 3: Writing Your First Android Application 55
Testing Your Development Environment 55
Building Your First Android Application 68
Summary 92
Quiz Questions 93
Exercises 94
References and More Information 94
Part II: Android Application Basics
Chapter 4: Understanding the Anatomy of an Android Application 97
Mastering Important Android Terminology 97
The Application Context 98
Performing Application Tasks with Activities 99
Organizing Activity Components with Fragments 105
Managing Activity Transitions with Intents 106
Working with Services 110
Receiving and Broadcasting Intents 111
Summary 112
Quiz Questions 112
Exercises 112
References and More Information 113
Chapter 5: Defining Your Application Using the Android Manifest File 115
Configuring Android Applications Using the Android Manifest File 115
Managing Your Application’s Identity 122
Enforcing Application System Requirements 123
Registering Activities in the Android Manifest 129
Working with Permissions 131
Exploring Other Manifest File Settings 133
Summary 133
Quiz Questions 134
Exercises 134
References and More Information 135
Chapter 6: Managing Application Resources 137
What Are Resources? 137
Setting Simple Resource Values Using the Android IDE 143
Working with Different Types of Resources 146
Working with Layouts 166
Referencing System Resources 171
Summary 172
Quiz Questions 173
Exercises 173
References and More Information 173
Part III: Android User Interface Design Essentials
Chapter 7: Exploring User Interface Building Blocks 177
Introducing Android Views and Layouts 177
Displaying Text to Users with TextView 179
Retrieving Data from Users with Text Fields 183
Giving Users Choices Using Spinner Controls 188
Allowing Simple User Selections with Buttons and Switches 190
Retrieving Dates, Times, and Numbers from Users with Pickers 197
Using Indicators to Display Progress and Activity to Users 199
Adjusting Progress with Seek Bars 202
Other Valuable User Interface Controls 203
Summary 207
Quiz Questions 207
Exercises 207
References and More Information 208
Chapter 8: Designing with Layouts 209
Creating User Interfaces in Android 209
Organizing Your User Interface 214
Using Built-in Layout Classes 215
Using Container Control Classes 232
Summary 239
Quiz Questions 239
Exercises 240
References and More Information 240
Chapter 9: Partitioning the User Interface with Fragments 243
Understanding Fragments 243
Using the Android Support Package 258
Exploring Nested Fragments 261
Summary 261
Quiz Questions 262
Exercises 262
References and More Information 263
Chapter 10: Displaying Dialogs 265
Choosing Your Dialog Implementation 265
Exploring the Different Types of Dialogs 266
Working with Dialogs and Dialog Fragments 267
Working with Support Package Dialog Fragments 271
Summary 275
Quiz Questions 276
Exercises 276
References and More Information 276
Part IV: Android Application Design Essentials
Chapter 11: Using Android Preferences 281
Working with Application Preferences 281
Finding Preferences Data on the Android File System 285
Creating Manageable User Preferences 286
Learning about Cloud Save for Android Applications 296
Summary 298
Quiz Questions 298
Exercises 299
References and More Information 299
Chapter 12: Working with Files and Directories 301
Working with Application Data on a Device 301
Practicing Good File Management 302
Understanding Android File Permissions 303
Working with Files and Directories 303
Summary 312
Quiz Questions 312
Exercises 313
References and More Information 313
Chapter 13: Leveraging Content Providers 315
Exploring Android’s Content Providers 315
Modifying Content Provider Data 324
Using Third-Party Content Providers 328
Summary 328
Quiz Questions 328
Exercises 329
References and More Information 329
Chapter 14: Designing Compatible Applications 331
Maximizing Application Compatibility 331
Designing User Interfaces for Compatibility 333
Providing Alternative Application Resources 338
Targeting Tablets, TVs, and Other New Devices 347
Targeting Google Chromecast Devices 350
Summary 350
Quiz Questions 350
Exercises 351
References and More Information 351
Part V: Publishing and Distributing Android Applications
Chapter 15: Learning the Android Software Development Process 355
An Overview of the Mobile Development Process 355
Choosing a Software Methodology 356
Gathering Application Requirements 357
Assessing Project Risks 364
Writing Essential Project Documentation 368
Leveraging Configuration Management Systems 369
Designing Mobile Applications 370
Developing Mobile Applications 373
Testing Mobile Applications 373
Deploying Mobile Applications 374
Supporting and Maintaining Mobile Applications 375
Summary 377
Quiz Questions 377
Exercises 377
References and More Information 378
Chapter 16: Designing and Developing Bulletproof Android Applications 379
Best Practices in Designing Bulletproof Mobile Applications 379
Avoiding Silly Mistakes in Android Application Design 388
Best Practices in Developing Bulletproof Mobile Applications 388
Summary 393
Quiz Questions 394
Exercises 394
References and More Information 394
Chapter 17: Planning the Android Application Experience 395
Thinking about Objectives 395
Techniques for Focusing Your Product Efforts 397
Charting Your Application’s Navigation 400
Encouraging Action 408
Communicating Your Application’s Identity 416
Designing Screen Layouts 417
Reacting Properly with Visual Feedback 418
Observing Target Users for Usability 418
Summary 419
Quiz Questions 420
Exercises 420
References and More Information 420
Chapter 18: Testing Android Applications 423
Best Practices in Testing Mobile Applications 423
Android Application Testing Essentials 435
More Android Automated Testing Programs and APIs 455
Summary 457
Quiz Questions 457
Exercises 457
References and More Information 458
Chapter 19: Publishing Your Android Application 459
Choosing the Right Distribution Model 459
Packaging Your Application for Publication 462
Publishing to Google Play 468
Google Play Staged Rollouts 478
Publishing to the Google Play Private Channel 478
Translating Your Application 478
Publishing Using Other Alternatives 479
Self-Publishing Your Application 479
Summary 480
Quiz Questions 481
Exercises 481
References and More Information 481
Part VI: Appendixes
Appendix A: Mastering the Android Development Tools 485
Using the Android Documentation 485
Leveraging the Android Emulator 489
Viewing Application Log Data with LogCat 490
Debugging Applications with DDMS 490
Using Android Debug Bridge (ADB) 490
Using the Resource Editors and UI Designer 491
Using the Android Hierarchy Viewer 493
Working with Nine-Patch Stretchable Graphics 497
Working with Other Android Tools 500
Summary 502
Quiz Questions 503
Exercises 503
References and More Information 503
Appendix B: Quick-Start Guide: The Android Emulator 505
Simulating Reality: The Emulator’s Purpose 505
Working with Android Virtual Devices 507
Launching the Emulator with a Specific AVD 512
Configuring the GPS Location of the Emulator 516
Calling between Two Emulator Instances 517
Messaging between Two Emulator Instances 518
Interacting with the Emulator through the Console 520
Enjoying the Emulator 524
Understanding Emulator Limitations 525
Summary 526
Quiz Questions 526
Exercises 527
References and More Information 527
Appendix C: Quick-Start Guide: Android DDMS 529
Using DDMS with the Android IDE and as a Standalone Application 529
Getting Up to Speed Using Key Features of DDMS 530
Working with Processes, Threads, and the Heap 531
Using the Allocation Tracker 534
Viewing Network Statistics 535
Working with the File Explorer 536
Working with the Emulator Control 539
Working with the System Information Pane 541
Taking Screen Captures of the Emulator and Device Screens 542
Working with Application Logging 543
Summary 544
Quiz Questions 545
Exercises 545
References and More Information 545
Appendix D: Android IDE and Eclipse Tips and Tricks 547
Organizing Your Android IDE Workspace 547
Writing Code in Java 552
Resolving Mysterious Build Errors 556
Summary 557
Quiz Questions 557
Exercises 557
References and More Information 557
Appendix E: Answers to Quiz Questions 559
Index 567