Professional Android™ 2 Application Development

Book description

Update to the bestseller now features the latest release of the Android platform

Android is a powerful, flexible, open source platform for mobile devices and its popularity is growing at an unprecedented pace. This update to the bestselling first edition dives in to cover the exciting new features of the latest release of the Android mobile platform.

Providing in-depth coverage of how to build mobile applications using the next major release of the Android SDK, this invaluable resource takes a hands-on approach to discussing Android with a series of projects, each of which introduces a new feature and highlights techniques and best practices to get the most out of Android.

  • The Android SDK is a powerful, flexible, open source platform for mobile devices

  • Shares helpful techniques and best practices to maximize the capabilities of Android

  • Explains the possibilities of Android through the use of a series of detailed projects

  • Demonstrates how to create real-world mobile applications for Android phones

  • Includes coverage of the latest version of Android

Providing concise and compelling examples, Professional Android Application Development is an updated guide aimed at helping you create mobile applications for mobile devices running the latest version of Android.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Table of contents

  1. Copyright
  2. ABOUT THE AUTHOR
  3. ABOUT THE TECHNICAL EDITOR
  4. CREDITS
  5. ACKNOWLEDGMENTS
  6. INTRODUCTION
    1. WHOM THIS BOOK IS FOR
    2. WHAT THIS BOOK COVERS
    3. HOW THIS BOOK IS STRUCTURED
    4. WHAT YOU NEED TO USE THIS BOOK
    5. CONVENTIONS
    6. SOURCE CODE
    7. ERRATA
    8. P2P.WROX.COM
  7. 1. Hello, Android
    1. 1.1. A LITTLE BACKGROUND
      1. 1.1.1. The Not-So-Distant Past
      2. 1.1.2. The Future
    2. 1.2. WHAT IT ISN'T
    3. 1.3. ANDROID: AN OPEN PLATFORM FOR MOBILE DEVELOPMENT
    4. 1.4. NATIVE ANDROID APPLICATIONS
    5. 1.5. ANDROID SDK FEATURES
      1. 1.5.1. Access to Hardware, Including Camera, GPS, and Accelerometer
      2. 1.5.2. Native Google Maps, Geocoding, and Location-Based Services
      3. 1.5.3. Background Services
      4. 1.5.4. SQLite Database for Data Storage and Retrieval
      5. 1.5.5. Shared Data and Interapplication Communication
      6. 1.5.6. Using Widgets, Live Folders, and Live Wallpaper to Enhance the Home Screen
      7. 1.5.7. Extensive Media Support and 2D/3D Graphics
      8. 1.5.8. Optimized Memory and Process Management
    6. 1.6. INTRODUCING THE OPEN HANDSET ALLIANCE
    7. 1.7. WHAT DOES ANDROID RUN ON?
    8. 1.8. WHY DEVELOP FOR MOBILE?
    9. 1.9. WHY DEVELOP FOR ANDROID?
      1. 1.9.1. What Has and Will Continue to Drive Android Adoption?
      2. 1.9.2. What Does It Have That Others Don't?
      3. 1.9.3. Changing the Mobile Development Landscape
    10. 1.10. INTRODUCING THE DEVELOPMENT FRAMEWORK
      1. 1.10.1. What Comes in the Box
      2. 1.10.2. Understanding the Android Software Stack
      3. 1.10.3. The Dalvik Virtual Machine
      4. 1.10.4. Android Application Architecture
      5. 1.10.5. Android Libraries
    11. 1.11. SUMMARY
  8. 2. Getting Started
    1. 2.1. DEVELOPING FOR ANDROID
      1. 2.1.1. What You Need to Begin
        1. 2.1.1.1. Downloading and Installing the SDK
        2. 2.1.1.2. Developing with Eclipse
        3. 2.1.1.3. Using the Eclipse Plug-In
          1. 2.1.1.3.1. Installing the ADT Plug-In
          2. 2.1.1.3.2. Updating the Plug-In
      2. 2.1.2. Creating Your First Android Application
        1. 2.1.2.1. Starting a New Android Project
        2. 2.1.2.2. Creating a Launch Configuration
        3. 2.1.2.3. Running and Debugging Your Android Applications
        4. 2.1.2.4. Understanding Hello World
      3. 2.1.3. Types of Android Applications
        1. 2.1.3.1. Foreground Applications
        2. 2.1.3.2. Background Services and Intent Receivers
        3. 2.1.3.3. Intermittent Applications
        4. 2.1.3.4. Widgets
    2. 2.2. DEVELOPING FOR MOBILE DEVICES
      1. 2.2.1. Hardware-Imposed Design Considerations
        1. 2.2.1.1. Be Efficient
        2. 2.2.1.2. Expect Limited Capacity
        3. 2.2.1.3. Design for Small Screens
        4. 2.2.1.4. Expect Low Speeds, High Latency
        5. 2.2.1.5. At What Cost?
      2. 2.2.2. Considering the Users' Environment
      3. 2.2.3. Developing for Android
        1. 2.2.3.1. Being Fast and Efficient
        2. 2.2.3.2. Being Responsive
        3. 2.2.3.3. Developing Secure Applications
        4. 2.2.3.4. Ensuring a Seamless User Experience
    3. 2.3. TO-DO LIST EXAMPLE
    4. 2.4. ANDROID DEVELOPMENT TOOLS
      1. 2.4.1. The Android Virtual Device and SDK Manager
        1. 2.4.1.1. Android Virtual Devices
        2. 2.4.1.2. SDK Manager
      2. 2.4.2. The Android Emulator
      3. 2.4.3. Dalvik Debug Monitor Service (DDMS)
      4. 2.4.4. The Android Debug Bridge (ADB)
    5. 2.5. SUMMARY
  9. 3. Creating Applications and Activities
    1. 3.1. WHAT MAKES AN ANDROID APPLICATION?
    2. 3.2. INTRODUCING THE APPLICATION MANIFEST
    3. 3.3. USING THE MANIFEST EDITOR
    4. 3.4. THE ANDROID APPLICATION LIFE CYCLE
    5. 3.5. UNDERSTANDING APPLICATION PRIORITY AND PROCESS STATES
    6. 3.6. EXTERNALIZING RESOURCES
      1. 3.6.1. Creating Resources
        1. 3.6.1.1. Creating Simple Values
          1. 3.6.1.1.1. Strings
          2. 3.6.1.1.2. Colors
          3. 3.6.1.1.3. Dimensions
        2. 3.6.1.2. Styles and Themes
        3. 3.6.1.3. Drawables
        4. 3.6.1.4. Layouts
        5. 3.6.1.5. Animations
          1. 3.6.1.5.1. Tweened Animations
          2. 3.6.1.5.2. Frame-by-Frame Animations
        6. 3.6.1.6. Menus
      2. 3.6.2. Using Resources
        1. 3.6.2.1. Using Resources in Code
        2. 3.6.2.2. Referencing Resources within Resources
        3. 3.6.2.3. Using System Resources
        4. 3.6.2.4. Referring to Styles in the Current Theme
      3. 3.6.3. To-Do List Resources Example
      4. 3.6.4. Creating Resources for Different Languages and Hardware
      5. 3.6.5. Runtime Configuration Changes
    7. 3.7. INTRODUCING THE ANDROID APPLICATION CLASS
      1. 3.7.1. Extending and Using the Application Class
      2. 3.7.2. Overriding the Application Life Cycle Events
    8. 3.8. A CLOSER LOOK AT ANDROID ACTIVITIES
      1. 3.8.1. Creating an Activity
      2. 3.8.2. The Activity Life Cycle
        1. 3.8.2.1. Activity Stacks
        2. 3.8.2.2. Activity States
        3. 3.8.2.3. Monitoring State Changes
        4. 3.8.2.4. Understanding Activity Lifetimes
          1. 3.8.2.4.1. The Full Lifetime
          2. 3.8.2.4.2. The Visible Lifetime
          3. 3.8.2.4.3. The Active Lifetime
      3. 3.8.3. Android Activity Classes
    9. 3.9. SUMMARY
  10. 4. Creating User Interfaces
    1. 4.1. FUNDAMENTAL ANDROID UI DESIGN
    2. 4.2. INTRODUCING VIEWS
      1. 4.2.1. Creating Activity User Interfaces with Views
      2. 4.2.2. The Android Widget Toolbox
    3. 4.3. INTRODUCING LAYOUTS
      1. 4.3.1. Using Layouts
      2. 4.3.2. Optimizing Layouts
    4. 4.4. CREATING NEW VIEWS
      1. 4.4.1. Modifying Existing Views
        1. 4.4.1.1. Customizing Your To-Do List
      2. 4.4.2. Creating Compound Controls
      3. 4.4.3. Creating Custom Views
        1. 4.4.3.1. Creating a New Visual Interface
          1. 4.4.3.1.1. Drawing Your Control
          2. 4.4.3.1.2. Sizing Your Control
        2. 4.4.3.2. Handling User Interaction Events
        3. 4.4.3.3. Creating a Compass View Example
      4. 4.4.4. Using Custom Controls
    5. 4.5. DRAWABLE RESOURCES
      1. 4.5.1. Shapes, Colors, and Gradients
        1. 4.5.1.1. Color Drawable
        2. 4.5.1.2. Shape Drawable
        3. 4.5.1.3. Gradient Drawable
      2. 4.5.2. Composite Drawables
        1. 4.5.2.1. Transformative Drawables
        2. 4.5.2.2. Layer Drawable
        3. 4.5.2.3. State List Drawables
        4. 4.5.2.4. Level List Drawables
      3. 4.5.3. NinePatch Drawable
    6. 4.6. RESOLUTION AND DENSITY INDEPENDENCE
      1. 4.6.1. The Resource Framework and Resolution Independence
        1. 4.6.1.1. Resource Qualifiers for Screen Size and Pixel Density
        2. 4.6.1.2. Specifying Supported Screen Sizes
      2. 4.6.2. Best Practices for Resolution Independence
        1. 4.6.2.1. Relative Layouts and Density-Independent Pixels
        2. 4.6.2.2. Using Scalable Graphics Assets
        3. 4.6.2.3. Provide Optimized Resources for Different Screens
      3. 4.6.3. Testing, Testing, Testing
        1. 4.6.3.1. Emulator Skins
        2. 4.6.3.2. Testing for Custom Resolutions and Screen Sizes
    7. 4.7. CREATING AND USING MENUS
      1. 4.7.1. Introducing the Android Menu System
      2. 4.7.2. Defining an Activity Menu
      3. 4.7.3. Menu Item Options
      4. 4.7.4. Dynamically Updating Menu Items
      5. 4.7.5. Handling Menu Selections
      6. 4.7.6. Submenus and Context Menus
        1. 4.7.6.1. Creating Submenus
        2. 4.7.6.2. Using Context Menus
          1. 4.7.6.2.1. Creating Context Menus
          2. 4.7.6.2.2. Handling Context Menu Selections
      7. 4.7.7. Defining Menus in XML
      8. 4.7.8. To-Do List Example Continued
    8. 4.8. SUMMARY
  11. 5. Intents, Broadcast Receivers, Adapters, and the Internet
    1. 5.1. INTRODUCING INTENTS
      1. 5.1.1. Using Intents to Launch Activities
        1. 5.1.1.1. Explicitly Starting New Activities
        2. 5.1.1.2. Implicit Intents and Late Runtime Binding
        3. 5.1.1.3. Returning Results from Activities
          1. 5.1.1.3.1. Launching Sub-Activities
          2. 5.1.1.3.2. Returning Results
          3. 5.1.1.3.3. Handling Sub-Activity Results
        4. 5.1.1.4. Native Android Actions
      2. 5.1.2. Using Intent Filters to Service Implicit Intents
        1. 5.1.2.1. How Android Resolves Intent Filters
        2. 5.1.2.2. Finding and Using the Launch Intent Within an Activity
        3. 5.1.2.3. Passing on Responsibility
        4. 5.1.2.4. Select a Contact Example
      3. 5.1.3. Using Intent Filters for Plug-Ins and Extensibility
        1. 5.1.3.1. Supplying Anonymous Actions to Applications
        2. 5.1.3.2. Incorporating Anonymous Actions in Your Activity's Menu
      4. 5.1.4. Introducing Linkify
        1. 5.1.4.1. The Native Linkify Link Types
        2. 5.1.4.2. Creating Custom Link Strings
        3. 5.1.4.3. Using the Match Filter
        4. 5.1.4.4. Using the Transform Filter
      5. 5.1.5. Using Intents to Broadcast Events
        1. 5.1.5.1. Broadcasting Events with Intents
        2. 5.1.5.2. Listening for Broadcasts with Broadcast Receivers
          1. 5.1.5.2.1. Registering Broadcast Receivers in Your Application Manifest
          2. 5.1.5.2.2. Registering Broadcast Receivers in Code
        3. 5.1.5.3. Broadcasting Sticky and Ordered Intents
        4. 5.1.5.4. Native Android Broadcast Actions
    2. 5.2. INTRODUCING PENDING INTENTS
    3. 5.3. INTRODUCING ADAPTERS
      1. 5.3.1. Introducing Some Native Adapters
      2. 5.3.2. Customizing the Array Adapter
      3. 5.3.3. Using Adapters for Data Binding
        1. 5.3.3.1. Customizing the To-Do List Array Adapter
        2. 5.3.3.2. Using the Simple Cursor Adapter
    4. 5.4. USING INTERNET RESOURCES
      1. 5.4.1. Connecting to an Internet Resource
      2. 5.4.2. Using Internet Resources
    5. 5.5. INTRODUCING DIALOGS
      1. 5.5.1. Introducing the Dialog Classes
        1. 5.5.1.1. The Alert Dialog Class
        2. 5.5.1.2. Specialist Input Dialogs
      2. 5.5.2. Using Activities as Dialogs
      3. 5.5.3. Managing and Displaying Dialogs
    6. 5.6. CREATING AN EARTHQUAKE VIEWER
    7. 5.7. SUMMARY
  12. 6. Files, Saving State, and Preferences
    1. 6.1. SAVING SIMPLE APPLICATION DATA
    2. 6.2. CREATING AND SAVING PREFERENCES
    3. 6.3. RETRIEVING SHARED PREFERENCES
    4. 6.4. CREATING A SETTINGS ACTIVITY FOR THE EARTHQUAKE VIEWER
    5. 6.5. INTRODUCING THE PREFERENCE ACTIVITY AND PREFERENCES FRAMEWORK
      1. 6.5.1. Defining a Preference Screen Layout in XML
        1. 6.5.1.1. Native Preference Controls
        2. 6.5.1.2. Using Intents to Import System Preference Screens
      2. 6.5.2. Introducing the Preference Activity
      3. 6.5.3. Finding and Using Preference Screen Shared Preferences
      4. 6.5.4. Introducing Shared Preference Change Listeners
    6. 6.6. CREATING A STANDARD PREFERENCE ACTIVITY FOR THE EARTHQUAKE VIEWER
    7. 6.7. SAVING ACTIVITY STATE
      1. 6.7.1. Saving and Restoring Instance State
      2. 6.7.2. Saving the To-Do List Activity State
    8. 6.8. SAVING AND LOADING FILES
    9. 6.9. INCLUDING STATIC FILES AS RESOURCES
    10. 6.10. FILE MANAGEMENT TOOLS
    11. 6.11. SUMMARY
  13. 7. Databases and Content Providers
    1. 7.1. INTRODUCING ANDROID DATABASES
      1. 7.1.1. Introducing SQLite Databases
      2. 7.1.2. Introducing Content Providers
    2. 7.2. INTRODUCING SQLite
    3. 7.3. CURSORS AND CONTENT VALUES
    4. 7.4. WORKING WITH SQLite DATABASES
      1. 7.4.1. Introducing the SQLiteOpenHelper
      2. 7.4.2. Opening and Creating Databases without SQLiteHelper
      3. 7.4.3. Android Database Design Considerations
      4. 7.4.4. Querying a Database
      5. 7.4.5. Extracting Results from a Cursor
      6. 7.4.6. Adding, Updating, and Removing Rows
        1. 7.4.6.1. Inserting New Rows
        2. 7.4.6.2. Updating a Row
        3. 7.4.6.3. Deleting Rows
      7. 7.4.7. Saving Your To-Do List
    5. 7.5. CREATING A NEW CONTENT PROVIDER
      1. 7.5.1. Exposing Access to the Data Source
      2. 7.5.2. Registering Your Provider
    6. 7.6. USING CONTENT PROVIDERS
      1. 7.6.1. Introducing Content Resolvers
      2. 7.6.2. Querying for Content
      3. 7.6.3. Adding, Updating, and Deleting Content
        1. 7.6.3.1. Inserts
        2. 7.6.3.2. Deletes
        3. 7.6.3.3. Updates
      4. 7.6.4. Accessing Files in Content Providers
    7. 7.7. CREATING AND USING AN EARTHQUAKE CONTENT PROVIDER
      1. 7.7.1. Creating the Content Provider
      2. 7.7.2. Using the Provider
    8. 7.8. NATIVE ANDROID CONTENT PROVIDERS
      1. 7.8.1. Using the Media Store Provider
      2. 7.8.2. Using the Contacts Provider
        1. 7.8.2.1. Introducing the Contacts Contract Content Provider
        2. 7.8.2.2. Reading Contact Details
        3. 7.8.2.3. Modifying and Augmenting Contact Details
    9. 7.9. SUMMARY
  14. 8. Maps, Geocoding, and Location-Based Services
    1. 8.1. USING LOCATION-BASED SERVICES
    2. 8.2. CONFIGURING THE EMULATOR TO TEST LOCATION-BASED SERVICES
    3. 8.3. UPDATING LOCATIONS IN EMULATOR LOCATION PROVIDERS
    4. 8.4. SELECTING A LOCATION PROVIDER
      1. 8.4.1. Finding the Available Providers
      2. 8.4.2. Finding Location Providers Using Criteria
    5. 8.5. FINDING YOUR LOCATION
      1. 8.5.1. 'Where Am I?' Example
      2. 8.5.2. Tracking Movement
      3. 8.5.3. Updating Your Location in 'Where Am I?'
    6. 8.6. USING PROXIMITY ALERTS
    7. 8.7. USING THE GEOCODER
      1. 8.7.1. Reverse Geocoding
      2. 8.7.2. Forward Geocoding
      3. 8.7.3. Geocoding 'Where Am I?'
    8. 8.8. CREATING MAP-BASED ACTIVITIES
      1. 8.8.1. Introducing Map View and Map Activity
      2. 8.8.2. Getting Your Maps API Key
        1. 8.8.2.1. Getting Your Development/Debugging MD5 Fingerprint
        2. 8.8.2.2. Getting your Production/Release MD5 Fingerprint
      3. 8.8.3. Creating a Map-Based Activity
      4. 8.8.4. Configuring and Using Map Views
      5. 8.8.5. Using the Map Controller
      6. 8.8.6. Mapping 'Where Am I?'
      7. 8.8.7. Creating and Using Overlays
        1. 8.8.7.1. Creating New Overlays
        2. 8.8.7.2. Introducing Projections
        3. 8.8.7.3. Drawing on the Overlay Canvas
        4. 8.8.7.4. Handling Map Tap Events
        5. 8.8.7.5. Adding and Removing Overlays
        6. 8.8.7.6. Annotating 'Where Am I?'
      8. 8.8.8. Introducing My Location Overlay
      9. 8.8.9. Introducing Itemized Overlays and Overlay Items
      10. 8.8.10. Pinning Views to the Map and Map Positions
    9. 8.9. MAPPING EARTHQUAKES EXAMPLE
    10. 8.10. SUMMARY
  15. 9. Working in the Background
    1. 9.1. INTRODUCING SERVICES
      1. 9.1.1. Creating and Controlling Services
        1. 9.1.1.1. Creating a Service
        2. 9.1.1.2. Registering a Service in the Manifest
        3. 9.1.1.3. Self-Terminating a Service
        4. 9.1.1.4. Starting, Controlling, and Interacting with a Service
        5. 9.1.1.5. An Earthquake Monitoring Service Example
      2. 9.1.2. Binding Activities to Services
      3. 9.1.3. Prioritizing Background Services
    2. 9.2. USING BACKGROUND THREADS
      1. 9.2.1. Using AsyncTask to Run Asynchronous Tasks
        1. 9.2.1.1. Creating a new Asynchronous Task
        2. 9.2.1.2. Running an Asynchronous Task
      2. 9.2.2. Moving the Earthquake Service to a Background Thread Using AsyncTask
      3. 9.2.3. Manual Thread Creation and GUI Thread Synchronization
        1. 9.2.3.1. Creating a New Thread
        2. 9.2.3.2. Using the Handler for Performing GUI Operations
    3. 9.3. LET'S MAKE A TOAST
      1. 9.3.1. Customizing Toasts
      2. 9.3.2. Using Toasts in Worker Threads
    4. 9.4. INTRODUCING NOTIFICATIONS
      1. 9.4.1. Introducing the Notification Manager
      2. 9.4.2. Creating Notifications
        1. 9.4.2.1. Creating a Notification and Configuring the Status Bar Icon
        2. 9.4.2.2. Configuring the Extended Status Notification Display
      3. 9.4.3. Triggering Notifications
      4. 9.4.4. Adding Notifications and Toasts to the Earthquake Monitor
      5. 9.4.5. Advanced Notification Techniques
        1. 9.4.5.1. Using the Defaults
        2. 9.4.5.2. Making Sounds
        3. 9.4.5.3. Vibrating the Phone
        4. 9.4.5.4. Flashing the Lights
      6. 9.4.6. Ongoing and Insistent Notifications
    5. 9.5. USING ALARMS
      1. 9.5.1. Setting Repeating Alarms
      2. 9.5.2. Using Repeating Alarms to Update Earthquakes
    6. 9.6. SUMMARY
  16. 10. Invading the Phone-Top
    1. 10.1. INTRODUCING HOME-SCREEN WIDGETS
    2. 10.2. CREATING APP WIDGETS
      1. 10.2.1. Creating the Widget Layout
        1. 10.2.1.1. Widget Design Guidelines
          1. 10.2.1.1.1. Widget Layout Sizes
          2. 10.2.1.1.2. Widget Visual Styling
        2. 10.2.1.2. Supported Widget Views and Layouts
      2. 10.2.2. Defining Your Widget Settings
      3. 10.2.3. Creating Your Widget Intent Receiver and Adding It to the Application Manifest
      4. 10.2.4. Introducing Remote Views and the App Widget Manager
        1. 10.2.4.1. Creating Remote Views and Using the App Widget Manager to Apply Them
        2. 10.2.4.2. Using a Remote View within the App Widget Provider's onUpdate Handler
        3. 10.2.4.3. Using Remote Views to Modify UI
        4. 10.2.4.4. Making Your Widgets Interactive
          1. 10.2.4.4.1. Using a Click Listener
          2. 10.2.4.4.2. Changing Image Views Based on Selection Focus
      5. 10.2.5. Refreshing Your Widgets
        1. 10.2.5.1. Using the Minimum Update Rate
        2. 10.2.5.2. Listening for Intents
        3. 10.2.5.3. Using Alarms
      6. 10.2.6. Creating and Using a Widget Configuration Activity
    3. 10.3. CREATING AN EARTHQUAKE WIDGET
    4. 10.4. INTRODUCING LIVE FOLDERS
      1. 10.4.1. Creating Live Folders
        1. 10.4.1.1. Live Folder Content Providers
        2. 10.4.1.2. Live Folder Activity
      2. 10.4.2. Creating an Earthquake Live Folder
    5. 10.5. ADDING SEARCH TO YOUR APPLICATIONS AND THE QUICK SEARCH BOX
      1. 10.5.1. Adding Search to Your Application
        1. 10.5.1.1. Creating a Search Activity
        2. 10.5.1.2. Responding to Search Queries from a Content Provider
      2. 10.5.2. Surfacing Search Results to the Quick Search Box
      3. 10.5.3. Adding Search to the Earthquake Example
    6. 10.6. CREATING LIVE WALLPAPER
      1. 10.6.1. Creating a Live Wallpaper Definition Resource
      2. 10.6.2. Creating a Wallpaper Service
      3. 10.6.3. Creating a Wallpaper Service Engine
    7. 10.7. SUMMARY
  17. 11. Audio, Video, and Using the Camera
    1. 11.1. PLAYING AUDIO AND VIDEO
      1. 11.1.1. Introducing the Media Player
      2. 11.1.2. Preparing Audio for Playback
        1. 11.1.2.1. Packaging Audio as an Application Resource
        2. 11.1.2.2. Initializing Audio Content for Playback
      3. 11.1.3. Preparing for Video Playback
        1. 11.1.3.1. Playing Video Using the Video View
        2. 11.1.3.2. Setting up a Surface for Video Playback
        3. 11.1.3.3. Initializing Video Content for Playback
      4. 11.1.4. Controlling Playback
      5. 11.1.5. Managing Media Playback Output
    2. 11.2. RECORDING AUDIO AND VIDEO
      1. 11.2.1. Using Intents to Record Video
      2. 11.2.2. Using the Media Recorder
        1. 11.2.2.1. Configuring and Controlling Video Recording
        2. 11.2.2.2. Previewing Video Recording
    3. 11.3. USING THE CAMERA AND TAKING PICTURES
      1. 11.3.1. Using Intents to Take Pictures
      2. 11.3.2. Controlling the Camera and Taking Pictures
        1. 11.3.2.1. Controlling and Monitoring Camera Settings and Image Options
        2. 11.3.2.2. Monitoring Auto Focus
        3. 11.3.2.3. Using the Camera Preview
        4. 11.3.2.4. Taking a Picture
      3. 11.3.3. Reading and Writing JPEG EXIF Image Details
    4. 11.4. ADDING NEW MEDIA TO THE MEDIA STORE
      1. 11.4.1.
        1. 11.4.1.1. Using the Media Scanner
        2. 11.4.1.2. Inserting Media into the Media Store
    5. 11.5. RAW AUDIO MANIPULATION
      1. 11.5.1. Recording Sound with Audio Record
      2. 11.5.2. Playing Sound with Audio Track
    6. 11.6. SPEECH RECOGNITION
    7. 11.7. SUMMARY
  18. 12. Telephony and SMS
    1. 12.1. TELEPHONY
      1. 12.1.1. Launching the Dialer to Initiate Phone Calls
      2. 12.1.2. Replacing the Native Dialer
      3. 12.1.3. Accessing Phone and Network Properties and Status
        1. 12.1.3.1. Reading Phone Device Details
        2. 12.1.3.2. Reading Data Connection and Transfer State
        3. 12.1.3.3. Reading Network Details
        4. 12.1.3.4. Reading SIM Details
      4. 12.1.4. Monitoring Changes in Phone State, Phone Activity, and Data Connections
        1. 12.1.4.1. Monitoring Incoming Phone Calls
        2. 12.1.4.2. Tracking Cell Location Changes
        3. 12.1.4.3. Tracking Service Changes
        4. 12.1.4.4. Monitoring Data Connectivity and Activity
    2. 12.2. INTRODUCING SMS AND MMS
      1. 12.2.1. Using SMS and MMS in Your Application
      2. 12.2.2. Sending SMS and MMS from Your Application Using Intents and the Native Client
      3. 12.2.3. Sending SMS Messages Manually
        1. 12.2.3.1. Sending Text Messages
        2. 12.2.3.2. Tracking and Confirming SMS Message Delivery
        3. 12.2.3.3. Conforming to the Maximum SMS Message Size
        4. 12.2.3.4. Sending Data Messages
      4. 12.2.4. Listening for Incoming SMS Messages
        1. 12.2.4.1. Simulating Incoming SMS Messages in the Emulator
        2. 12.2.4.2. Handling Data SMS Messages
      5. 12.2.5. Emergency Responder SMS Example
      6. 12.2.6. Automating the Emergency Responder
    3. 12.3. SUMMARY
  19. 13. Bluetooth, Networks, and Wi-Fi
    1. 13.1. USING BLUETOOTH
      1. 13.1.1. Accessing the Local Bluetooth Device Adapter
      2. 13.1.2. Managing Bluetooth Properties and State
      3. 13.1.3. Being Discoverable and Remote Device Discovery
        1. 13.1.3.1. Managing Device Discoverability
        2. 13.1.3.2. Discovering Remote Devices
      4. 13.1.4. Bluetooth Communications
        1. 13.1.4.1. Opening a Bluetooth Server Socket Listener
        2. 13.1.4.2. Selecting Remote Bluetooth Devices for Communications
          1. 13.1.4.2.1. Bluetooth Device Connection Requirements
          2. 13.1.4.2.2. Finding a Bluetooth Device to Connect To
        3. 13.1.4.3. Opening a Client Bluetooth Socket Connection
        4. 13.1.4.4. Transmitting Data Using Bluetooth Sockets
      5. 13.1.5. Bluetooth Data Transfer Example
    2. 13.2. MANAGING NETWORK CONNECTIVITY
      1. 13.2.1. Introducing the Connectivity Manager
      2. 13.2.2. Reading User Preferences for Background Data Transfer
      3. 13.2.3. Monitoring Network Details
      4. 13.2.4. Finding and Configuring Network Preferences and Controlling Hardware Radios
      5. 13.2.5. Monitoring Network Connectivity
    3. 13.3. MANAGING YOUR WI-FI
      1. 13.3.1. Monitoring Wi-Fi Connectivity
      2. 13.3.2. Monitoring Active Connection Details
      3. 13.3.3. Scanning for Hotspots
      4. 13.3.4. Managing Wi-Fi Configurations
      5. 13.3.5. Creating Wi-Fi Network Configurations
    4. 13.4. SUMMARY
  20. 14. Sensors
    1. 14.1. USING SENSORS AND THE SENSOR MANAGER
      1. 14.1.1. Introducing Sensors
        1. 14.1.1.1. Supported Android Sensors
        2. 14.1.1.2. Finding Sensors
        3. 14.1.1.3. Using Sensors
    2. 14.2. INTERPRETING SENSOR VALUES
    3. 14.3. USING THE COMPASS, ACCELEROMETER, AND ORIENTATION SENSORS
      1. 14.3.1. Introducing Accelerometers
      2. 14.3.2. Detecting Acceleration Changes
      3. 14.3.3. Creating a G-Forceometer
      4. 14.3.4. Determining Your Orientation
        1. 14.3.4.1. Determining Orientation Using the Orientation Sensor
        2. 14.3.4.2. Calculating Orientation Using the Accelerometer and Magnetic Field Sensors
        3. 14.3.4.3. Remapping the Orientation Reference Frame
      5. 14.3.5. Creating a Compass and Artificial Horizon
    4. 14.4. CONTROLLING DEVICE VIBRATION
    5. 14.5. SUMMARY
  21. 15. Advanced Android Development
    1. 15.1. PARANOID ANDROID
      1. 15.1.1. Linux Kernel Security
      2. 15.1.2. Introducing Permissions
      3. 15.1.3. Declaring and Enforcing Permissions
      4. 15.1.4. Enforcing Permissions for Broadcast Intents
    2. 15.2. USING WAKE LOCKS
    3. 15.3. INTRODUCING ANDROID TEXT TO SPEECH
    4. 15.4. USING AIDL TO SUPPORT IPC FOR SERVICES
      1. 15.4.1. Implementing an AIDL Interface
      2. 15.4.2. Passing Class Objects as Parcelables
        1. 15.4.2.1. Creating the AIDL Service Definition
      3. 15.4.3. Implementing and Exposing the IPC Interface
    5. 15.5. USING INTERNET SERVICES
    6. 15.6. BUILDING RICH USER INTERFACES
      1. 15.6.1. Working with Animations
        1. 15.6.1.1. Introducing Tweened Animations
        2. 15.6.1.2. Creating Tweened Animations
        3. 15.6.1.3. Applying Tweened Animations
        4. 15.6.1.4. Using Animation Listeners
        5. 15.6.1.5. Animated Sliding User Interface Example
        6. 15.6.1.6. Animating Layouts and View Groups
          1. 15.6.1.6.1. Creating Layout Animations
          2. 15.6.1.6.2. Using Layout Animations
        7. 15.6.1.7. Creating and Using Frame-by-Frame Animations
      2. 15.6.2. Advanced Canvas Drawing
        1. 15.6.2.1. What Can You Draw?
        2. 15.6.2.2. Getting the Most from Your Paint
          1. 15.6.2.2.1. Using Translucency
          2. 15.6.2.2.2. Introducing Shaders
          3. 15.6.2.2.3. Defining Gradient Shaders
          4. 15.6.2.2.4. Using Shader Tile Modes
          5. 15.6.2.2.5. Using Mask Filters
          6. 15.6.2.2.6. Using Color Filters
          7. 15.6.2.2.7. Using Path Effects
          8. 15.6.2.2.8. Changing the Xfermode
        3. 15.6.2.3. Improving Paint Quality with Anti-Aliasing
        4. 15.6.2.4. Canvas Drawing Best Practice
        5. 15.6.2.5. Advanced Compass Face Example
        6. 15.6.2.6. Bringing Map Overlays to Life
      3. 15.6.3. Introducing the Surface View
        1. 15.6.3.1. When Should You Use a Surface View?
        2. 15.6.3.2. Creating a New Surface View
        3. 15.6.3.3. Creating 3D Controls with a Surface View
      4. 15.6.4. Creating Interactive Controls
        1. 15.6.4.1. Using the Touch Screen
          1. 15.6.4.1.1. Processing Single and Multiple Touch Events
          2. 15.6.4.1.2. Tracking Movement
          3. 15.6.4.1.3. Using an On Touch Listener
        2. 15.6.4.2. Using the Device Keys, Buttons, and D-Pad
        3. 15.6.4.3. Using the On Key Listener
        4. 15.6.4.4. Using the Trackball
    7. 15.7. SUMMARY

Product information

  • Title: Professional Android™ 2 Application Development
  • Author(s): Reto Meier
  • Release date: March 2010
  • Publisher(s): Wrox
  • ISBN: 9780470565520