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.
This EPUB will be accessible from your Account page after purchase.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
What Every Android App Developer Should Know Today: Android 6 Tools, App/UI Design, Testing, Publishing, and More
Introduction to Android™ Application Development, Fifth Edition, is the most useful real-world guide to building robust, commercial-grade Android apps with the new Android 6 SDK, Android Studio, and latest development best practices. Bigger, better, and more comprehensive than ever, this book covers everything you need to start developing professional apps for modern Android devices. If you’re serious about Android development, this guide will prepare you to build virtually any app you can imagine!
Three well-respected experts guide you through setting up your development environment, designing user interfaces, developing for diverse devices, and optimizing your entire app-development process. Up-to-date code listings support in-depth explanations of key API features, and many chapters contain multiple sample apps.
This fifth edition adds brand-new chapters on material design, styling applications, design patterns, and querying with SQLite. You’ll find a treasure trove of Android Studio tips, plus a brand-new appendix on the Gradle build system. This edition also offers
Download this book’s source code at informit.com/title/9780134389455 or introductiontoandroid.blogspot.com.
Acknowledgments xxxi
About the Authors xxxiii
Introduction 1
Part I: Platform Overview
Chapter 1: Presenting Android 11
The Android Open Source Project (AOSP) 11
The Open Handset Alliance 12
Android Platform Uniqueness 16
The Android Platform 21
Android beyond the OHA and GMS 26
Summary 28
Quiz Questions 28
Exercises 28
References and More Information 29
Chapter 2: Setting Up for Development 31
Configuring Your Development Environment 31
Exploring the Android SDK 38
Summary 48
Quiz Questions 48
Exercises 48
References and More Information 48
Chapter 3: Creating Your First Application 51
Testing Your Development Environment 51
Building Your First Android Application 57
Summary 73
Quiz Questions 74
Exercises 74
References and More Information 74
Part II: Application Basics
Chapter 4: Understanding Application Components 77
Mastering Important Android Terminology 77
The Application Context 78
Performing Application Tasks with Activities 80
Organizing Activity Components with Fragments 85
Managing Activity Transitions with Intents 87
Working with Services 90
Receiving and Broadcasting Intents 91
Summary 92
Quiz Questions 92
Exercises 93
References and More Information 93
Chapter 5: Defining the Manifest 95
Configuring Android Applications Using the Android Manifest File 95
Managing Your Application’s Identity 99
Enforcing Application System Requirements 100
Registering Activities in the Android Manifest 103
Working with Permissions 105
Exploring Other Manifest File Settings 109
Summary 109
Quiz Questions 109
Exercises 110
References and More Information 110
Chapter 6: Managing Application Resources 111
What Are Resources? 111
Adding Simple Resource Values in Android Studio 116
Working with Different Types of Resources 120
Working with Layouts 140
Referencing System Resources 144
Summary 145
Quiz Questions 146
Exercises 146
References and More Information 146
Chapter 7: Exploring Building Blocks 147
Introducing Android Views and Layouts 147
Displaying Text to Users with TextView 148
Retrieving Data from Users with Text Fields 152
Giving Users Choices Using Spinner Controls 157
Allowing Simple User Selections with Buttons and Switches 159
Retrieving Dates, Times, and Numbers from Users with Pickers 166
Using Indicators to Display Progress and Activity to Users 168
Adjusting Progress with Seek Bars 171
Other Valuable User Interface Controls 173
Summary 177
Quiz Questions 177
Exercises 177
References and More Information 178
Chapter 8: Positioning with Layouts 179
Creating User Interfaces in Android 179
Organizing Your User Interface 184
Using Built-in Layout Classes 185
Using Container Control Classes 203
Summary 210
Quiz Questions 210
Exercises 211
References and More Information 211
Chapter 9: Partitioning with Fragments 213
Understanding Fragments 213
Using the Android Support Library Package 228
Additional Ways to Use Fragments 231
Summary 232
Quiz Questions 232
Exercises 233
References and More Information 233
Part III: Application Design Essentials
Chapter 10: Architecting with Patterns 237
Architecting Your Application’s Navigation 237
Encouraging Action 251
Summary 267
Quiz Questions 267
Exercises 267
References and More Information 268
Chapter 11: Appealing with Style 269
Styling with Support 269
Themes and Styles 269
Colors 272
Layout 273
Application Branding 278
The Results Applied 280
Typography 280
Summary 282
Quiz Questions 282
Exercises 283
References and More Information 283
Chapter 12: Embracing Material Design 285
Understanding Material 285
The Default Material Theme 286
The SampleMaterial Application 286
Implementing the SampleMaterial Application 286
Summary 317
Quiz Questions 317
Exercises 317
References and More Information 318
Chapter 13: Designing Compatible Applications 319
Maximizing Application Compatibility 319
Designing User Interfaces for Compatibility 321
Providing Alternative Application Resources 324
Targeting Tablets and TVs 336
Extending Your Application to Watches and Cars 338
Ensuring Compatibility with SafetyNet 339
Summary 340
Quiz Questions 340
Exercises 341
References and More Information 341
Part IV: Application Development Essentials
Chapter 14: Using Android Preferences 345
Working with Application Preferences 345
Finding Preferences Data on the File System 349
Creating Manageable User Preferences 350
Auto Backup for Android Applications 359
Summary 361
Quiz Questions 361
Exercises 361
References and More Information 362
Chapter 15: Accessing Files and Directories 363
Working with Application Data on a Device 363
Practicing Good File Management 364
Understanding Android File Permissions 365
Working with Files and Directories 366
Summary 375
Quiz Questions 375
Exercises 375
References and More Information 376
Chapter 16: Saving with SQLite 377
SampleMaterial Upgraded with SQLite 377
Working with Databases 377
Summary 390
Quiz Questions 390
Exercises 391
References and More Information 391
Chapter 17: Leveraging Content Providers 393
Exploring Android’s Content Providers 393
Modifying Content Provider Data 402
Using Third-Party Content Providers 406
Summary 406
Quiz Questions 406
Exercises 407
References and More Information 407
Part V: Application Delivery Essentials
Chapter 18: Learning the Development Workflow 411
An Overview of the Android Development Process 411
Choosing a Software Methodology 412
Gathering Application Requirements 413
Assessing Project Risks 421
Writing Essential Project Documentation 425
Leveraging Configuration Management Systems 426
Designing Android Applications 427
Developing Android Applications 430
Testing Android Applications 431
Deploying Android Applications 432
Supporting and Maintaining Android Applications 433
Summary 434
Quiz Questions 435
Exercises 435
References and More Information 435
Chapter 19: Planning the Experience 437
Thinking about Objectives 437
Techniques for Focusing Your Product Efforts 439
Communicating Your Application’s Identity 442
Designing Screen Layouts 443
Reacting Properly with Visual Feedback 444
Observing Target Users for Usability 445
Summary 446
Quiz Questions 446
Exercises 447
References and More Information 447
Chapter 20: Delivering Quality Applications 449
Best Practices in Delivering Quality Applications 449
Avoiding Silly Mistakes in Android Application Design 459
Best Practices in Delivering Quality Android Applications 459
Summary 464
Quiz Questions 465
Exercises 465
References and More Information 465
Chapter 21: Testing Your Applications 467
Best Practices in Testing Mobile Applications 467
Android Application Testing Essentials 479
More Android Automated Testing Programs and APIs 496
Summary 497
Quiz Questions 497
Exercises 498
References and More Information 498
Chapter 22: Distributing Your Applications 499
Choosing the Right Distribution Model 499
Packaging Your Application for Publication 502
Publishing to Google Play 509
Google Play Staged Rollouts 518
Publishing to the Google Play Private Channel 518
Translating Your Application 519
Publishing Using Other Alternatives 520
Self-Publishing Your Application 520
Summary 522
Quiz Questions 522
Exercises 522
References and More Information 523
Part VI: Appendixes
Appendix A: Tips and Tricks: Android Studio 527
Organizing Your Android Studio Workspace 527
Writing Code in Java 533
Resolving Mysterious Build Errors 537
Summary 537
Quiz Questions 538
Exercises 538
References and More Information 538
Appendix B: Quick-Start: Android Emulator 539
Simulating Reality: The Emulator’s Purpose 539
Working with Android Virtual Devices 541
Launching the Emulator with a Specific AVD 548
Configuring the GPS Location of the Emulator 555
Calling between Two Emulator Instances 557
Messaging between Two Emulator Instances 558
Interacting with the Emulator through the Console 559
Personalizing the Emulator 563
Understanding Emulator Limitations 563
Summary 565
Quiz Questions 565
Exercises 565
References and More Information 565
Appendix C: Quick-Start: Android Device Monitor 567
Using Device Monitor with Android Studio and as a Stand-Alone Application 567
Getting Up to Speed Using Key Features of Device Monitor 568
Working with Processes, Threads, and the Heap 569
Using the Allocation Tracker 573
Viewing Network Statistics 574
Working with the File Explorer 575
Working with the Emulator Control 578
Working with the System Information Pane 580
Taking Screen Captures of the Emulator and Device Screens 580
Working with Application Logging 581
Summary 582
Quiz Questions 583
Exercises 583
References and More Information 583
Appendix D: Mastery: Android SDK Tools 585
Using the Android Documentation 585
Leveraging the Android Emulator 588
Viewing Application Log Data with logcat 589
Debugging Applications with Device Monitor 590
Using Android Debug Bridge (ADB) 591
Using the Layout Editor 591
Using the Android Hierarchy Viewer 592
Working with Nine-Patch Stretchable Graphics 596
Working with Other Android Tools 597
Summary 600
Quiz Questions 600
Exercises 600
References and More Information 601
Appendix E: Quick-Start: Gradle Build System 603
Gradle Build Files 603
Using Android Studio to Configure Your Builds 609
Summary 620
Quiz Questions 620
Exercises 621
References and More Information 621
Appendix F: Answers to Quiz Questions 623
Index 631