Cover
Title Page
Copyright Page
Contents at a Glance
Table of Contents
About the Author
Acknowledgments
Preface
Welcome to the Book!
Prerequisites
Editions of This Book
Source Code and Its License
Chapter 1 The Big Picture
Challenges of Smartphone Programming
What Androids Are Made Of
Stuff at Your Disposal
Chapter 2 Projects and Targets
Pieces and Parts
Creating a Project
Project Structure
Inside the Manifest
Emulators and Targets
Chapter 3 Creating a Skeleton Application
Begin at the Beginning
Dissecting the Activity
Building and Running the Activity
Chapter 4 Using XML-Based Layouts
What Is an XML-Based Layout?
Why Use XML-Based Layouts?
OK, So What Does It Look Like?
What’s with the @ Signs?
And How Do We Attach These to the Java?
The Rest of the Story
Chapter 5 Employing Basic Widgets
Assigning Labels
Button, Button, Who’s Got the Button?
Fleeting Images
Fields of Green. Or Other Colors.
Just Another Box to Check
Turn the Radio Up
It’s Quite a View
Chapter 6 Working with Containers
Thinking Linearly
All Things Are Relative
Tabula Rasa
Scrollwork
Chapter 7 Using Selection Widgets
Adapting to the Circumstances
Lists of Naughty and Nice
Spin Control
Grid Your Lions (or Something Like That...)
Fields: Now with 35% Less Typing!
Galleries, Give or Take the Art
Chapter 8 Getting Fancy with Lists
Getting to First Base
A Dynamic Presentation
Better. Stronger. Faster.
Making a List...
...And Checking It Twice
Adapting Other Adapters
Chapter 9 Employing Fancy Widgets and Containers
Pick and Choose
Time Keeps Flowing Like a River
Making Progress
Seeking Resolution
Put It on My Tab
Flipping Them Off
Getting in Someone’s Drawer
Other Good Stuff
Chapter 10 The Input Method Framework
Keyboards, Hard and Soft
Tailored to Your Needs
Tell Android Where It Can Go
Fitting In
Unleash Your Inner Dvorak
Chapter 11 Applying Menus
Menus of Options
Menus in Context
Taking a Peek
Yet More Inflation
Chapter 12 Fonts
Love the One You’re With
More Fonts
Here a Glyph, There a Glyph
Chapter 13 Embedding the WebKit Browser
A Browser, Writ Small
Loading It Up
Navigating the Waters
Entertaining the Client
Settings, Preferences, and Options (Oh My!)
Chapter 14 Showing Pop-Up Messages
Raising Toasts
Alert! Alert!
Checking Them Out
Chapter 15 Dealing with Threads
Getting Through the Handlers
Running in Place
Where Oh Where Has My UI Thread Gone?
Asyncing Feeling
And Now, the Caveats
Chapter 16 Handling Activity Life Cycle Events
Schroedinger’s Activity
Life, Death, and Your Activity
The Grace of State
Chapter 17 Creating Intent Filters
What’s Your Intent?
Stating Your Intent(ions)
Narrow Receivers
The Pause Caveat
Chapter 18 Launching Activities and Subactivities
Peers and Subs
Start ’Em Up
Tabbed Browsing, Sort Of
Chapter 19 Handling Rotation
A Philosophy of Destruction
It’s All the Same, Just Different
Now with More Savings!
DIY Rotation
Forcing the Issue
Making Sense of It All
Chapter 20 Working with Resources
The Resource Lineup
String Theory
Got the Picture?
XML: The Resource Way
Miscellaneous Values
Different Strokes for Different Folks
Chapter 21 Using Preferences
Getting What You Want
Stating Your Preference
And Now, a Word from Our Framework
Letting Users Have Their Say
Adding a Wee Bit o' Structure
The Kind of Pop-Ups You Like
Chapter 22 Managing and Accessing Local Databases
The Database Example
A Quick SQLite Primer
Start at the Beginning
Setting the Table
Makin’ Data
What Goes Around Comes Around
Data, Data, Everywhere
Chapter 23 Accessing Files
You and the Horse You Rode in On
Readin’ ’n Writin’
Chapter 24 Leveraging Java Libraries
The Outer Limits
Ants and JARs
Following the Script
...And Not a Drop to Drink
Reviewing the Script
Chapter 25 Communicating via the Internet
REST and Relaxation
HTTP Operations via Apache HttpClient
Parsing Responses
Stuff to Consider
Chapter 26 Using a Content Provider
Pieces of Me
Getting a Handle
Makin’ Queries
Adapting to the Circumstances
Give and Take
Beware of the BLOB!
Chapter 27 Building a Content Provider
First, Some Dissection
Next, Some Typing
Creating Your Content Provider
Notify-on-Change Support
Chapter 28 Requesting and Requiring Permissions
Mother, May I?
Halt! Who Goes There?
May I See Your Documents?
Chapter 29 Creating a Service
Service with Class
There Can Only Be One
Manifest Destiny
Lobbing One Over the Fence
Where’s the Remote? And the Rest of the Code?
Chapter 30 Invoking a Service
The Ties That Bind
Catching the Lob
Chapter 31 Alerting Users via Notifications
Types of Pestering
Seeing Pestering in Action
Chapter 32 Accessing Location-Based Services
Location Providers: They Know Where You’re Hiding
Finding Yourself
On the Move
Are We There Yet? Are We There Yet? Are We There Yet?
Testing...Testing...
Chapter 33 Mapping with MapViewand Map Activity
Terms, Not of Endearment
Piling On
The Bare Bones
Exercising Your Control
Rugged Terrain
Layers upon Layers
My, Myself, and MyLocationOverlay
The Key to It All
Chapter 34 Handling Telephone Calls
Report to the Manager
You Make the Call!
Chapter 35 Development Tools
Hierarchical Management
Delightful Dalvik Debugging Detailed, Demoed
Put It on My Card
Chapter 36 Handling Multiple Screen Sizes
Taking the Default
Whole in One
Tailor-Made, Just for You (and You, and You, and...)
Ain’t Nothing Like the Real Thing
Ruthlessly Exploiting the Situation
Example: EU4You
What Are a Few Bugs Among Friends?
Chapter 37 Dealing with Devices
This App Contains Explicit Instructions
Button, Button, Who’s Got the Button?
A Guaranteed Market
The Down and Dirty Details
Chapter 38 Handling Platform Changes
Brand Management
More Things That Make You Go Boom
Handling API Changes
Chapter 39 Where Do We Go from Here?
Questions—Sometimes with Answers
Heading to the Source
Getting Your News Fix
Index