PacktLib: Android 3.0 Application Development Cookbook

Android 3.0 Application Development Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Activities

Introduction

Declaring an activity

Starting a new activity with an intent object

Switching between activities

Returning a result from an activity

Storing an activity's state

Storing persistent activity data

Managing the activity lifecycle

Layouts

Introduction

Declaring a layout

Applying a relative layout

Applying a table layout

Using ListViews and ListAdapters

Applying gravity and weight

Controlling layout during runtime

Optimizing for tablets and multiple screens

Dividing the screen into fragments

Running 3.0 and higher applications on older platforms

Widgets

Introduction

Inserting a widget into a layout

Adding images to widgets

Creating a widget at runtime

Applying a style

Turning a style into a theme

Using a platform style or theme

Creating a custom component

Menus

Introduction

Creating and inflating an options menu

Designing Android compliant menu icons

Building a context sensitive menu

Handling menu selections

Building menu groups of checkable items

Applying shortcut keys and submenus

Data and Security

Introduction

Using internal storage for private data

Storing public data on external storage

Creating a SQLite database

Sharing multimedia files across applications with Content Providers

Defining and enforcing permissions

Providing backup functionality

Detecting User Activity

Introduction

Reading a device's orientation

Measuring motion with the accelerometer

Listing available sensors

Recognizing a touch event

Detecting multi-touch elements

Recognizing gestures

Handling multi-touch gestures

Controlling on screen keyboards

Notifying the User

Introduction

Displaying an alert dialog

Displaying a progress dialog

Customizing a dialog

Making a Toast

Notifying the user with the status bar

Using the Notifcation.Builder class

Graphics and Animation

Introduction

Adding graphics to the ImageView class

Rotating an image with a matrix

Using ShapeDrawable and Paint

Drawing with a Canvas

Using tween animations

Animating with Honeycomb APIs

Creating stop frame animations

Working with OpenGL

Multimedia

Introduction

Playing an audio file from within an application

Playing back video from external memory

Playing multiple sounds with a SoundPool

Recording audio

Recording video

Capturing photos with the camera

Telephony, Networks, and the Web

Introduction

Initiating a phone call

Listening for phone events

Sending SMS messages

Monitoring SMS messages

Connecting to WiFi

Connecting Bluetooth devices

Including web content

GPS, Locations, and Maps

Introduction

Detecting a device's location

Listening for location changes

Setting up Google Maps

Zooming in on a MapView

Setting a map's location with a GeoPoint

Marking a location on a map with an overlay

Index