Key Questions Answered in This Book
An Overview of Changes in This Edition
The Development Environment Used in This Book
Supplementary Materials Available
Where to Find More Information
I: Advanced Android Application Design Principles
1 Threading and Asynchronous Processing
The Importance of Processing Asynchronously
Working with the AsyncTask
Class
References and More Information
Determining When to Use Services
Understanding the Service
Lifecycle
Implementing a Remote Interface
Implementing a Parcelable
Class
References and More Information
3 Leveraging SQLite Application Databases
Storing Structured Data Using SQLite Databases
Creating, Updating, and Deleting Database Records
Executing More Complex Queries Using SQLiteQueryBuilder
Executing Raw Queries without Builders and Column Mapping
Closing and Deleting a SQLite Database
Deleting Tables and Other SQLite Objects
Deleting a SQLite Database Instance Using the Application Context
Designing Persistent Databases
Keeping Track of Database Field Names
Extending the SQLiteOpenHelper
Class
Binding Data to the Application User Interface
Working with Database Data Like Any Other Data
Binding Data to Controls Using Data Adapters
References and More Information
4 Building Android Content Providers
Implementing a Content Provider Interface
Implementing Important Content Provider Methods
Enhancing Applications Using Content Providers
References and More Information
5 Broadcasting and Receiving Intents
Registering to Receive Broadcasts
Handling Incoming Broadcasts from the System
Securing Application Broadcasts
References and More Information
Using the NotificationManager
Service
Creating a Simple Text Notification with an Icon
Working with the Notification Queue
Expandable and Contractible Notifications
Introducing the Notification Listener
Designing Useful Notifications
References and More Information
II: Advanced Android User Interface Design Principles
7 Designing Powerful User Interfaces
Following Android User Interface Guidelines
Handling Application Icon Clicks on the Action Bar
Working with Screens That Do Not Require Action Bars
References and More Information
8 Handling Advanced User Input
Working with Textual Input Methods
Working with Software Keyboards
Working with Text Prediction and User Dictionaries
Listening for Touch Mode Changes
Listening for Events on the Entire Screen
Detecting User Motions within a View
Handling Common Single-Touch Gestures
Handling Common Multitouch Gestures
Using the Drag-and-Drop Framework
Handling Screen Orientation Changes
References and More Information
9 Designing Accessible Applications
Exploring the Accessibility Framework
Leveraging Speech Recognition Services
Leveraging Text-to-Speech Services
Testing Application Accessibility
References and More Information
10 Development Best Practices for Tablets, TVs, and Wearables
Understanding Device Diversity
Don’t Make Assumptions about Device Characteristics
Designing Flexible User Interfaces
Leveraging Alternative Resources
Using Screen Space Effectively on Big Landscape Screens
Developing Applications for Tablets
Developing Applications for TV
Developing Applications for Wearables
References and More Information
III: Leveraging Common Android APIs
11 Using Android Networking APIs
Understanding Mobile Networking Fundamentals
Understanding StrictMode
with Networking
Handling Network Operations Asynchronously
Retrieving Android Network Status
References and More Information
Designing a Layout with a WebView
Control
Loading Content into a WebView
Control
Adding Features to the WebView
Control
Extending Web Application Functionality to Android
Debugging WebViews with Chrome DevTools
Working with Adobe AIR and Flash
References and More Information
13 Using Android Multimedia APIs
Capturing Still Images Using the Camera
Configuring Camera Mode Settings
Working with Common Camera Parameters
Assigning Images as Wallpapers
Choosing among Various Device Cameras
References and More Information
14 Using Android Telephony APIs
Working with Telephony Utilities
Gaining Permission to Access Phone State Information
Requesting Service Information
Monitoring Signal Strength and Data Connection Speed
SMS Applications Other than the Default
Making and Receiving Phone Calls
References and More Information
15 Accessing Android’s Hardware Sensors
Interacting with Device Hardware
Working with Different Sensors
Configuring the Android Manifest File for Sensors
Acquiring a Reference to a Sensor
Determining Device Orientation
References and More Information
16 Using Android’s Optional Hardware APIs
Checking for the Existence of Bluetooth Hardware
Establishing Connections between Devices
Receiving Android Beam Messages
Configuring the Manifest File for Android Beam
Introducing Host Card Emulation
References and More Information
17 Using Location and Map APIs
Incorporating Android Location APIs
Using the Global Positioning System (GPS)
Doing More with Android Location-Based Services
Incorporating Google Location Services APIs
Locating with the Fused Location Provider
Doing More with Google Location Services
Incorporating Google Maps Android API v2
References and More Information
18 Working with Google Cloud Messaging
Understanding GCM Message Flow
Understanding the Limitations of the GCM Service
Incorporating GCM into Your Applications
Exploring the GCM Sample Applications
What Alternatives to GCM Exist?
References and More Information
19 An Overview of In-App Billing APIs for Android
Leveraging Google Play In-App Billing APIs
Leveraging Amazon Appstore for Android In-App Purchasing APIs
Leveraging PayPal Billing APIs
References and More Information
20 Enabling Application Statistics with Google Analytics
Creating a Google Account for Analytics
Adding the Library to Your Android IDE Project
Collecting Data from Your Applications
Using the Google Analytics Dashboard
Gathering E-commerce Information
Logging E-commerce Events in Your Applications
Tracking Ad and Market Referrals
References and More Information
21 An Overview of Google Play Game Services
Getting Up and Running with Google Play Game Services
Incorporating Google Play Game Services into Your Applications
Saving Game Data with Cloud Save
Introducing Multiplayer Gaming
References and More Information
V: Drawing, Animations, and Graphics Programming with Android
22 Developing Android 2D Graphics Applications
Working with Canvases and Paints
Understanding the Canvas
Object
Understanding the Paint
Object
Using Default Fonts and Typefaces
Measuring Text Screen Requirements
Drawing Bitmap
Graphics on a Canvas
Transforming Bitmaps Using Matrixes
Bitmap
Performance Optimizations
Defining Shape Drawables as XML Resources
Defining Shape Drawables Programmatically
Leveraging Hardware Acceleration Features
Controlling Hardware Acceleration
Fine-Tuning Hardware Acceleration
References and More Information
Working with Drawable Animation
Working with Property Animation
Working with Different Interpolators
State Animations with Scenes and Transitions
References and More Information
24 Developing Android 3D Graphics Applications
Leveraging OpenGL ES in Android
Using OpenGL ES APIs in the Android SDK
Handling OpenGL ES Tasks Manually
Starting Your OpenGL ES Thread
Interacting with Android Views and Events
Enabling the OpenGL Thread to Talk to the Application Thread
Enabling the Application Thread to Talk to the OpenGL Thread
Using GLSurfaceView
(Easy OpenGL ES)
Configuring Your Application for OpenGL ES 2.0
Requesting an OpenGL ES 2.0 Surface
References and More Information
Determining When to Use the Android NDK
Exploring the Android NDK Sample Application
Handling Parameters and Return Values
Using Exceptions with Native Code
Improving Graphics Performance
Comparing RenderScript
to the NDK
References and More Information
VI: Maximizing Android’s Unique Features
26 Extending Android Application Reach
Installing an App Widget to the Home Screen
Introducing Lock Screen App Widgets
Installing an App Widget to the Lock Screen
Creating a Live Wallpaper Service
Creating a Live Wallpaper Configuration
Configuring the Android Manifest File for Live Wallpapers
Acting as a Content Type Handler
Determining Intent
Actions and MIME Types
Implementing the Activity
to Process the Intents
References and More Information
27 Enabling Application Search
Making Application Content Searchable
Enabling Searches in Your Application
Creating a Search Configuration
Configuring the Android Manifest File for Search
Updating a Search Configuration for Global Searches
Updating Search Settings for Global Searches
References and More Information
28 Managing User Accounts and Synchronizing User Data
Managing Accounts with the Account Manager
Multiple Users, Restricted Profiles, and Accounts
Synchronizing Data with Sync Adapters
Choosing a Remote Backup Service
Backing Up and Restoring Application Data
References and More Information
VII: Advanced Topics in Application Publication and Distribution
29 Internationalizing Your Applications
Localizing Your Application’s Language
Internationalization Using Alternative Resources
Changing the Language Settings
Implementing Locale Support Programmatically
Right-to-Left Language Localization
Translation Services through Google Play
Publishing Applications for Foreign Users
References and More Information
30 Protecting Applications from Software Piracy
All Applications Are Vulnerable
Configuring ProGuard for Your Android Applications
Dealing with Error Reports after Obfuscation
Leveraging the License Verification Library
References and More Information
VIII: Preparing for Future Android Releases
31 Introducing the L Developer Preview
Exploring the L Developer Preview
Understanding Android TV Development Requirements
Understanding TV Application Hardware Limitations
References and More Information
A Quick-Start Guide: Android Debug Bridge
Listing Connected Devices and Emulators
Directing ADB Commands to Specific Devices
Starting and Stopping the ADB Server
Stopping the ADB Server Process
Starting and Checking the ADB Server Process
Issuing a Single Shell Command
Using the Shell to Start and Stop the Emulator
Sending Files to a Device or Emulator
Retrieving Files from a Device or Emulator
Installing and Uninstalling Applications
Displaying All Log Information
Including Date and Time with Log Data
Redirecting Log Output to a File
Controlling the Backup Service
Using the Shell to Inspect SQLite Databases
Using the Shell to Stress Test Applications
Letting the Monkey Loose on Your Application
Directing Your Monkey’s Actions
Training Your Monkey to Repeat His Tricks
Learning More about Your Monkey
Installing Custom Binaries via the Shell
References and More Information
Exploring Common Tasks with SQLite
Using the sqlite3
Command-Line Interface
Connecting to a SQLite Database
Importing and Exporting the Database and Its Data
Executing SQL Commands on the Command Line
Understanding SQLite Limitations
Learning by Example: A Student Grade Database
Designing the Student Grade Database Schema
Creating Simple Tables with AUTOINCREMENT
Querying Tables for Results with SELECT
Using Foreign Keys and Composite Primary Keys
Altering and Updating Data in Tables
Querying Multiple Tables Using JOIN
Using Subqueries for Calculated Columns
References and More Information
Learning the Java Programming Language
Learning the Java Development Tools
Familiarizing Yourself with Java Documentation
Chaining Methods and Unnecessary Temp Variables
Working with Unary and Ternary Operators
References and More Information
D Quick-Start Guide: Android Studio
Getting Up and Running with Android Studio
Launching Android Studio for the First Time
Creating an Android Studio Project
Understanding the Android Studio Project Structure
Learning about the Gradle Build System
Overview of the Android Studio User Interface
Debugging Your Android Studio Applications
3.141.103.61