O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Android™ Developer’s Cookbook: Building Applications with the Android SDK, Second Edition

Book Description

Do you want to get started building apps for Android, today’s number one mobile platform? Are you already building Android apps but want to get better at it? The AndroidDeveloper’s Cookbook, Second Edition, brings together all the expert guidance and code you’ll need.

This edition has been extensively updated to reflect the other Android 4.2.2 releases. You’ll find all-new chapters on advanced threading and UI development, in-app billing, push messages, and native development, plus new techniques for everything from accessing NFC hardware to using Google Cloud Messaging.

Proven modular recipes take you from the basics all the way to advanced services, helping you to make the most of the newest Android APIs and tools. The authors’ fully updated code samples are designed to serve as templates for your own projects and components. You’ll learn best-practice techniques for efficiently solving common problems and for avoiding pitfalls throughout the entire development lifecycle. Coverage includes

  • Organizing Android apps and integrating their activities

  • Working efficiently with services, receivers, and alerts

  • Managing threads, including advanced techniques using AsyncTasks and loaders

  • Building robust, intuitive user interfaces

  • Implementing advanced UI features, including Custom Views, animation, accessibility, and large screen support

  • Capturing, playing, and manipulating media

  • Interacting with SMS, websites, and social networks

  • Storing data via SQLite and other methods

  • Integrating in-app billing using Google Play services

  • Managing push messaging with C2DM

  • Leveraging new components and structures for native Android development

  • Efficiently testing and debugging with Android’s latest tools and techniques, including LINT code analysis

  • The AndroidDeveloper’s Cookbook, Second Edition, is all you need to jumpstart any Android project, and create high-value, feature-rich apps that sell.

    Table of Contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Praise for The Android™ Developer’s Cookbook, Second Edition
    5. Dedication Page
    6. Contents at a Glance
    7. Table of Contents
    8. Preface
      1. Why an Android Cookbook?
      2. Who Should Read This Book?
      3. Using the Recipes
      4. Book Structure
      5. Additional References
    9. About the Authors
    10. 1. Overview of Android
      1. The Evolution of Android
      2. The Dichotomy of Android
      3. Devices Running Android
      4. Hardware Differences on Android Devices
      5. Features of Android
      6. Android Development
      7. Software Development Kit (SDK)
      8. Google Play
    11. 2. Application Basics: Activities and Intents
      1. Android Application Overview
      2. Activity Lifecycle
      3. Multiple Activities
    12. 3. Threads, Services, Receivers, and Alerts
      1. Threads
      2. Messages between Threads: Handlers
      3. Alerts
      4. Services
      5. Broadcast Receivers
      6. App Widgets
    13. 4. Advanced Threading Techniques
      1. Loaders
      2. AsyncTasks
      3. Android Inter-Process Communication
    14. 5. User Interface Layout
      1. Resource Directories and General Attributes
      2. Views and ViewGroups
      3. Text Manipulation
      4. Other Widgets: From Buttons to Seek Bars
    15. 6. User Interface Events
      1. Event Handlers and Event Listeners
      2. Advanced User Interface Libraries
    16. 7. Advanced User Interface Techniques
      1. Android Custom View
      2. Android Animation
      3. Accessibility
      4. Fragments
    17. 8. Multimedia Techniques
      1. Images
      2. Audio
      3. Video
    18. 9. Hardware Interface
      1. Camera
      2. Other Sensors
      3. Telephony
      4. Bluetooth
      5. Near Field Communication (NFC)
      6. Universal Serial Bus (USB)
    19. 10. Networking
      1. Reacting to the Network State
      2. Using SMS
      3. Using Web Content
      4. Social Networking
    20. 11. Data Storage Methods
      1. Shared Preferences
      2. SQLite Database
      3. Content Provider
      4. File Saving and Loading
    21. 12. Location-Based Services
      1. Location Basics
      2. Using Google Maps
      3. Using the Little Fluffy Location Library
    22. 13. In-App Billing
      1. Google Play In-App Billing
    23. 14. Push Messages
      1. Google Cloud Messaging Setup
      2. Sending and Receiving Push Messages
      3. Receiving Messages
      4. Sending Messages
    24. 15. Android Native Development
      1. Android Native Components
    25. 16. Debugging
      1. Android Test Projects
      2. Eclipse Built-In Debug Tools
      3. Android SDK Debug Tools
      4. Android System Debug Tools
    26. A. Using the OpenIntents Sensor Simulator
      1. Setting Up the Sensor Simulator
      2. Adding the Sensor Simulator to an Application
    27. B. Using the Compatibility Pack
      1. Android Support Packages
      2. Adding the Support Library to a Project
    28. C. Using a Continuous Integration System
    29. D. Android OS Releases
      1. Cupcake: Android OS 1.5, API Level 3, Released April 30, 2009
      2. Donut: Android OS 1.6, API Level 4, Released September 15, 2009
      3. Eclair: Android OS 2.0, API Level 5, Released October 26, 2009
      4. Froyo: Android OS 2.2, API Level 8, Released May 20, 2010
      5. Gingerbread: Android OS 2.3, API Level 9, Released December 6, 2010
      6. Honeycomb: Android OS 3.0, API Level 11, Released February 22, 2011
      7. Ice Cream Sandwich: Android OS 4.0, API Level 14, Released October 19, 2011
      8. Jelly Bean: Android OS 4.1, API Level 16, Released July 9, 2012
    30. Index