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

Android Recipes: A Problem-Solution Approach, Third Edition

Book Description

Android continues to be one of the leading mobile OS and development platforms driving today's mobile innovations and the apps ecosystem. Android appears complex, but offers a variety of organized development kits to those coming into Android with differing programming language skill sets.

Android Recipes: A Problem-Solution Approach, Third Edition offers more than 100 down-to-earth code recipes, and guides you step-by-step through a wide range of useful topics using complete and real-world working code examples. It's updated to include the KitKat Android 4.4 SDK as well as earlier releases.

Instead of abstract descriptions of complex concepts, in Android Recipes, you'll find live code examples. When you start a new project you can consider copying and pasting the code and configuration files from this book and then modifying them for your own customization needs.

Crammed with insightful instruction and helpful examples, this third edition of Android Recipes is your guide to writing apps for one of today's hottest mobile platforms. It offers pragmatic advice that will help you get the job done quickly and well. This can save you a great deal of work over creating a project from scratch!

What you'll learn

  • Use external libraries to save time and effort

  • Boost app performance by using the Android NDK and Renderscript

  • Design apps for performance, responsiveness, and seamlessness

  • Send data between devices and other external hardware

  • Persist application data and share it between applications

  • Capture and play back various device media items

  • Communicate with web services

  • Get the most out of your user interface

  • Develop a unit conversion app in the context of the command-line/Android SDK and Eclipse/Android SDK environments

  • Who this book is for

    This book is a handy reference for all Android app developers.

    Table of Contents

    1. Title Page
    2. Contents at a Glance
    3. Contents
    4. Foreword
    5. About the Authors
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Introduction
    9. Chapter 1: Getting Started with Android
      1. 1-1. What Is Android?
      2. 1-2. Exploring the History of Android
      3. 1-3. Installing the Android SDK
      4. 1-4. Installing an Android Platform
      5. 1-5. Creating an Android Virtual Device
      6. 1-6. Starting the AVD
      7. 1-7. Migrating to Eclipse
      8. 1-8. Creating Java Library JARs
      9. 1-9. Creating Android Library Projects
      10. 1-10. Using Core Libraries in Applications
      11. Summary
    10. Chapter 2: Views, Graphics, and Drawing
      1. 2-1. Customizing the Window
      2. 2-2. Creating and Displaying Views
      3. 2-3. Animating a View
      4. 2-4. Animating Layout Changes
      5. 2-5. Creating Drawables as Backgrounds
      6. 2-6. Creating Custom State Drawables
      7. 2-7. Applying Masks to Images
      8. 2-8. Drawing over View Content
      9. 2-9. Implementing Situation-Specific Layouts
      10. 2-10. Customizing AdapterView Empty Views
      11. 2-11. Customizing ListView Rows
      12. 2-12. Making ListView Section Headers
      13. 2-13. Creating Compound Controls
      14. 2-14. Customizing Transition Animations
      15. 2-15. Creating View Transformations
      16. 2-16. High-Performance Drawing
      17. Summary
    11. Chapter 3: User Interaction Recipes
      1. 3-1. Leveraging the Action Bar
      2. 3-2. Locking Activity Orientation
      3. 3-3. Performing Dynamic Orientation Locking
      4. 3-4. Manually Handling Rotation
      5. 3-5. Creating Pop-up Menu Actions
      6. 3-6. Displaying a User Dialog
      7. 3-7. Customizing Menus and Actions
      8. 3-8. Customizing BACK Behavior
      9. 3-9. Emulating the HOME Button
      10. 3-10. Monitoring TextView Changes
      11. 3-11. Customizing Keyboard Actions
      12. 3-12. Dismissing the Soft Keyboard
      13. 3-13. Handling Complex Touch Events
      14. 3-14. Forwarding Touch Events
      15. 3-15. Blocking Touch Thieves
      16. 3-16. Making Drag-and-Drop Views
      17. 3-17. Building a Navigation Drawer
      18. 3-18. Swiping Between Views
      19. 3-19. Creating Modular Interfaces
      20. Summary
    12. Chapter 4: Communications and Networking
      1. 4-1. Displaying Web Information
      2. 4-2. Intercepting WebView Events
      3. 4-3. Accessing WebView with JavaScript
      4. 4-4. Downloading an Image File
      5. 4-5. Downloading Completely in the Background
      6. 4-6. Accessing a REST API
      7. 4-7. Parsing JSON
      8. 4-8. Parsing XML
      9. 4-9. Receiving SMS
      10. 4-10. Sending an SMS Message
      11. 4-11. Communicating over Bluetooth
      12. 4-12. Querying Network Reachability
      13. 4-13. Transferring Data with NFC
      14. 4-14. Connecting over USB
      15. Summary
    13. Chapter 5: Interacting with Device Hardware and Media
      1. 5-1. Integrating Device Location
      2. 5-2. Mapping Locations
      3. 5-3. Annotating Maps
      4. 5-4. Monitoring Location Regions
      5. 5-5. Capturing Images and Video
      6. 5-6. Making a Custom Camera Overlay
      7. 5-7. Recording Audio
      8. 5-8. Capturing Custom Video
      9. 5-9. Adding Speech Recognition
      10. 5-10. Playing Back Audio/Video
      11. 5-11. Playing Sound Effects
      12. 5-12. Creating a Tilt Monitor
      13. 5-13. Monitoring Compass Orientation
      14. 5-14. Retrieving Metadata from Media Content
      15. 5-15. Detecting User Motion
      16. Summary
    14. Chapter 6: Persisting Data
      1. 6-1. Making a Preference Screen
      2. 6-2. Displaying Custom Preferences
      3. 6-3. Persisting Simple Data
      4. 6-4. Reading and Writing Files
      5. 6-5. Using Files as Resources
      6. 6-6. Managing a Database
      7. 6-7. Querying a Database
      8. 6-8. Backing Up Data
      9. 6-9. Sharing Your Database
      10. 6-10. Sharing Your SharedPreferences
      11. 6-11. Sharing Your Other Data
      12. Summary
    15. Chapter 7: Interacting with the System
      1. 7-1. Notifying from the Background
      2. 7-2. Creating Timed and Periodic Tasks
      3. 7-3. Scheduling a Periodic Task
      4. 7-4. Creating Sticky Operations
      5. 7-5. Running Persistent Background Operations
      6. 7-6. Launching Other Applications
      7. 7-7. Launching System Applications
      8. 7-8. Letting Other Applications Launch Your Application
      9. 7-9. Interacting with Contacts
      10. 7-10. Reading Device Media and Documents
      11. 7-11. Saving Device Media and Documents
      12. 7-12. Reading Messaging Data
      13. 7-13. Interacting with the Calendar
      14. 7-14. Logging Code Execution
      15. 7-15. Creating a Background Worker
      16. 7-16. Customizing the Task Stack
      17. 7-17. Implementing AppWidgets
      18. 7-18. Supporting Restricted Profiles
      19. Summary
    16. Chapter 8: Working with Android NDK and RenderScript
      1. Android NDK
      2. 8-1. Developing Low-Level Native Activities
      3. 8-2. Developing High-Level Native Activities
      4. RenderScript
      5. 8-3. Filtering Images with RenderScript
      6. 8-4. Manipulating Images with RenderScript
      7. 8-5. Faking Translucent Overlays with Blur
      8. Summary
    17. Index