Contents

images Contents at a Glance

images Contents

images About the Author

images Acknowledgments

images Preface

images Chapter 1: The Big Picture

Challenges of Smartphone Programming

What Androids Are Made Of

Stuff at Your Disposal

images Chapter 2: Projects and Targets

Pieces and Parts

Creating a Project

Project Structure

Root Contents

The Sweat Off Your Brow

And Now, the Rest of the Story

What You Get Out of It

Inside the Manifest

In the Beginning, There Was the Root, And It Was Good

Permissions, Instrumentations, and Applications (Oh My!)

Your Application Does Something, Right?

Achieving the Minimum

Version=Control

Emulators and Targets

Virtually There

Aiming at a Target

images Chapter 3: Creating a Skeleton Application

Begin at the Beginning

Dissecting the Activity

Building and Running the Activity

images 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

images 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

Useful Properties

Useful Methods

Colors

images Chapter 6: Working with Containers

Thinking Linearly

LinearLayout Concepts and Properties

LinearLayout Example

All Things Are Relative

RelativeLayout Concepts and Properties

RelativeLayout Example

Tabula Rasa

TableLayout Concepts and Properties

TableLayout Example

Scrollwork

images Chapter 7: Using Selectiosn 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

images Chapter 8: Getting Fancy with Lists

Getting to First Base

A Dynamic Presentation

Better. Stronger. Faster.

Using convertView

Using the Holder Pattern

Making a List…

…And Checking It Twice

Adapting Other Adapters

images 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

The Pieces

The Idiosyncrasies

Wiring It Together

Adding Them Up

Intents and Views

Flipping Them Off

Manual Flipping

Adding Contents on the Fly

Automatic Flipping

Getting in Someone’s Drawer

Other Good Stuff

images 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

images Chapter 11: Applying Menus

Menus of Options

Creating an Options Menu

Adding Menu Choices and Submenus

Menus in Context

Taking a Peek

Yet More Inflation

Menu XML Structure

Menu Options and XML

Inflating the Menu

images Chapter 12: Fonts

Love the One You're With

More Fonts

Here a Glyph, There a Glyph

images 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!)

images Chapter 14: Showing Pop-Up Messages

Raising Toasts

Alert! Alert!

Checking Them Out

images Chapter 15: Dealing with Threads

Getting Through the Handlers

Messages

Runnables

Running in Place

Where Oh Where Has My UI Thread Gone?

Asyncing Feeling

The Theory

AsyncTask, Generics, and Varargs

The Stages of AsyncTask

A Sample Task

And Now, the Caveats

images Chapter 16: Handling Activity Life Cycle Events

Schroedinger's Activity

Life, Death, and Your Activity

onCreate() and onDestroy()

onStart(), onRestart(), and onStop()

onPause() and onResume()

The Grace of State

images Chapter 17: Creating Intent Filters

What's Your Intent?

Pieces of Intents

Intent Routing

Stating Your Intent(ions)

Narrow Receivers

The Pause Caveat

images Chapter 18: Launching Activities and Subactivities

Peers and Subs

Start 'Em Up

Make an Intent

Make the Call

Tabbed Browsing, Sort Of

images 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

images Chapter 20: Working with Resources

The Resource Lineup

String Theory

Plain Strings

String Formats

Styled Text

Styled String Formats

Got the Picture?

XML: The Resource Way

Miscellaneous Values

Dimensions

Colors

Arrays

Different Strokes for Different Folks

images 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

images 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

Raw Queries

Regular Queries

Building with Builders

Using Cursors

Data, Data, Everywhere

images Chapter 23: Accessing Files

You and the Horse You Rode in On

Readin’ ’n Writin’

images Chapter 24: Leveraging Java Libraries

The Outer Limits

Ants and JARs

Following the Script

...And Not a Drop to Drink

Reviewing the Script

images Chapter 25: Communicating via the Internet

REST and Relaxation

HTTP Operations via Apache HttpClient

Parsing Responses

Stuff to Consider

images 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!

images Chapter 27: Building a Content Provider

First, Some Dissection

Next, Some Typing

Creating Your Content Provider

Step 1: Create a Provider Class

Step 2: Supply a Uri

Step 3: Declare the Properties

Step 4: Update the Manifest

Notify-on-Change Support

images Chapter 28: Requesting and Requiring Permissions

Mother, May I?

Halt! Who Goes There?

Enforcing Permissions via the Manifest

Enforcing Permissions Elsewhere

May I See Your Documents?

images Chapter 29: Creating a Service

Service with Class

There Can Only Be One

Manifest Destiny

Lobbing One Over the Fence

Callbacks

Broadcast Intents

Where's the Remote? And the Rest of the Code?

images Chapter 30: Invoking a Service

The Ties That Bind

Catching the Lob

images Chapter 31: Alerting Users via Notifications

Types of Pestering

Hardware Notifications

Icons

Seeing Pestering in Action

images 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…

images Chapter 33: Mapping with MapView and MapActivity

Terms, Not of Endearment

Piling On

The Bare Bones

Exercising Your Control

Zoom

Center

Rugged Terrain

Layers upon Layers

Overlay Classes

Drawing the ItemizedOverlay

Handling Screen Taps

My, Myself, and MyLocationOverlay

The Key to It All

images Chapter 34: Handling Telephone Calls

Report to the Manager

You Make the Call!

images Chapter 35: Development Tools

Hierarchical Management

Delightful Dalvik Debugging Detailed, Demoed

Logging

File Push and Pull

Screenshots

Location Updates

Placing Calls and Messages

Put It on My Card

Creating a Card Image

Inserting the Card

images Chapter 36: Handling Multiple Screen Sizes

Taking the Default

Whole in One

Think About Rules, Rather Than Positions

Consider Physical Dimensions

Avoid Real Pixels

Choose Scalable Drawables

Tailor-Made, Just for You (and You, and You, and...)

Add <supports-screens>

Resources and Resource Sets

Default Scaling

Density-Based Sets

Size-Based Sets

Version-Based Sets

Finding Your Size

Ain't Nothing Like the Real Thing

Density Differs

Adjusting the Density

Accessing Actual Devices

Ruthlessly Exploiting the Situation

Replace Menus with Buttons

Replace Tabs with a Simple Activity

Consolidate Multiple Activities

Example: EU4You

The First Cut

Fixing the Fonts

Fixing the Icons

Using the Space

What If It's Not a Browser?

What Are a Few Bugs Among Friends?

images 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

Archos 5 Android Internet Tablet

Motorola CLIQ/DEXT

Motorola DROID/Milestone

Google/HTC Nexus One

Motorola BACKFLIP

images Chapter 38: Handling Platform Changes

Brand Management

More Things That Make You Go Boom

View Hierarchy

Changing Resources

Handling API Changes

Detecting the Version

Wrapping the API

images Chapter 39: Where Do We Go from Here?

Questions—Sometimes with Answers

Heading to the Source

Getting Your News Fix

images Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset