You are previewing The Android™ Tablet Developer’s Cookbook.
O'Reilly logo
The Android™ Tablet Developer’s Cookbook

Book Description

The Android Tablet Developer’s Cookbook helps experienced Android developers leverage new Android 4.2.2 features to build compelling applications that take full advantage of tablets’ bigger screens, dual-core processors, and larger, faster memory.

Tightly focused on Android 4.2.2’s tablet-related capabilities, it presents an unparalleled library of easy-to-reuse code for solving real-world problems. Everything’s organized in modular, standalone sections to help you quickly find what you’re looking for, even when you need to use multiple classes together.

Throughout, B.M. Harwani clearly explains how Android tablet apps are unique, how to leverage Android skills and libraries you’ve already mastered, and how to efficiently integrate tablet APIs and features. From media to NFC, porting phone apps to integrating analytics, this book will help you do it fast and do it right.

Coverage includes

  • Providing user control via the system clipboard, notifications, and pending intents

  • Supporting drag and drop for both text and images

  • Displaying navigation and core app functionality via the ActionBar

  • Using widgets to present calendars, number pickers, image stacks, and options lists

  • Delivering powerful graphics via animation and hardware accelerated 2D

  • Recording audio, video, and images

  • Responding to sensors

  • Pairing tablets to other Bluetooth-enabled Android devices or PCs

  • Using Wi-Fi Direct to share media

  • Creating custom home screen widgets

  • Making the most of threads and the AsyncTask class

  • Exchanging data via JSON

  • Displaying and browsing Web content via the WebView widget

  • Creating fragments dynamically at runtime and implementing communication between fragments

  • Porting apps from smartphones to tablets and building new apps for both

  • Supporting older versions of the Android SDK

  • Sharing data and messages via NFC with Android Beam

  • Integrating app analytics and tracking

  • Turn to The Android Tablet Developer’s Cookbook for proven, expert answers—and the code you need to implement them. It’s all you need to jump-start any project and quickly create compelling Android tablet apps that sell!

    Table of Contents

    1. Title Page
    2. Copyright Page
    3. Dedication
    4. Contents
    5. Foreword [This content is currently in development.]
    6. Preface [This content is currently in development.]
    7. Acknowledgments
    8. About the Author
    9. Introduction
      1. Who Should Read This Book
      2. Key Topics That This Book Covers
      3. Key Benefits That This Book Provides
      4. How This Book Is Organized
      5. Code Examples for This Book
      6. Assumptions
    10. Part I: User Interface Techniques
      1. 1. Overview of Android Tablet Applications
        1. Recipe: Introducing Android Tablets
        2. Recipe: Knowing Differences Between Android Phones and Android Tablets
        3. Recipe: Making an Application Compatible for the Android Phone and the Android Tablet
        4. Recipe: Creating Android Virtual Devices
        5. Recipe: Understanding the Directory Structure of an Android Project
        6. Recipe: Converting an Android Phone Application into an Android Tablet Application
        7. Recipe: Forcing an Application to Run Only on Tablets
        8. Recipe: Understanding Activities
        9. Recipe: Understanding the Android Activity Life Cycle
        10. Recipe: Starting Activity Using Intent
        11. Recipe: Passing Data from One Activity to Another
        12. Summary
      2. 2. Fragments
        1. Recipe: Introducing Fragments
        2. Recipe: Understanding the Life Cycle of a Fragment
        3. Recipe: Creating Foreground Fragments, and Knowing the Difference Between Foreground and Background Fragments
        4. Recipe: Adding and Removing Fragments with Device Orientation
        5. Recipe: Understanding the Role of FragmentManager and FragmentTransaction in Handling Fragments
        6. Recipe: Creating Fragments Dynamically at Runtime
        7. Recipe: Implementing Communication Between Fragments
        8. Recipe: Displaying Options Using ListFragment
        9. Recipe: Displaying Dialog Through DialogFragment
        10. Recipe: Setting User’s Preferences with PreferenceFragment
        11. Summary
      3. 3. ActionBars in Action
        1. Recipe: Understanding the Difference Between the Menu and the ActionBar
        2. Recipe: Toggling ActionBar Visibility
        3. Recipe: Understanding the ActionBar Components
        4. Recipe: Displaying Action Items in the ActionBar
        5. Recipe: Navigating to the Application Home Page After Selecting the Application Icon
        6. Recipe: Displaying Action Views in the ActionBar
        7. Recipe: Displaying a Submenu in the ActionBar
        8. Recipe: Creating Tabbed ActionBar
        9. Recipe: Creating a Drop-Down List ActionBar
        10. Summary
      4. 4. New Widgets
        1. Recipe: Displaying the Calendar in an Android Application
        2. Recipe: Displaying and Selecting Numbers Through NumberPicker
        3. Recipe: Creating a Stack of Images Using StackView
        4. Recipe: Displaying List of Options Using ListPopupWindow
        5. Recipe: Suggesting Options Using PopupMenu
        6. Summary
    11. Part II: Managing Content
      1. 5. System Clipboard, and Drag and Drop
        1. Recipe: Understanding Drag and Drop Operation
        2. Recipe: Dragging and Dropping Text
        3. Recipe: Dragging and Dropping Images
        4. Recipe: Cutting, Copying, and Pasting Text Using the System Clipboard
        5. Summary
      2. 6. Notifications and Pending Intents
        1. Recipe: Understanding Pending Intents
        2. Recipe: Broadcasting an Intent
        3. Recipe: Understanding Android Notification System
        4. Recipe: Creating Notifications
        5. Recipe: Using Notification.Builder
        6. Recipe: Obtaining a NotificationManager
        7. Recipe: Creating Notification and Using Pending Intent to Start an Activity
        8. Summary
      3. 7. Loaders
        1. Recipe: Understanding Loaders
        2. Recipe: Understanding Content Provider
        3. Recipe: Using CursorLoader to Access Information in the Contacts Content Provider
        4. Recipe: Creating a Custom Content Provider
        5. Recipe: Listing Information in a Custom Content Provider
        6. Recipe: Updating and Deleting Information in a Custom Content Provider
        7. Summary
    12. Part III: Multimedia Techniques
      1. 8. Animation
        1. Recipe: Understanding Types of Animations
        2. Recipe: Using ValueAnimator
        3. Recipe: Using ObjectAnimator to Animate Views
        4. Recipe: Multiple Animations Using AnimatorSet
        5. Recipe: Understanding Frame-by-Frame Animation
        6. Recipe: Using Tweening Animation
        7. Recipe: Applying Layout Animation
        8. Recipe: Collecting and Sequencing Animations Using AnimationSet
        9. Summary
      2. 9. Hardware-Accelerated 2D
        1. Recipe: Understanding Hardware Acceleration
        2. Recipe: Using View Layers
        3. Recipe: Improving Graphics-Based Application Performance Using SurfaceView
        4. Recipe: Applying Transformations Using TextureView
        5. Summary
      3. 10. Creating and Rendering Graphics
        1. Recipe: Understanding the APIs Required for Graphics
        2. Recipe: Creating and Rendering a Rectangle Using OpenGL
        3. Recipe: Applying Smooth Coloring
        4. Recipe: Rotating Graphics
        5. Recipe: Scaling Graphics
        6. Recipe: Translating Graphics
        7. Summary
      4. 11. Recording Audio, Video, and Images
        1. Recipe: Capturing an Image Using Built-In Intent
        2. Recipe: Capturing an Image Using Java Code
        3. Recipe: Recording Audio Using Built-In Intent
        4. Recipe: Understanding CamcorderProfile
        5. Recipe: Understanding MediaRecorder and Its Methods
        6. Recipe: Recording Audio Using Java Code
        7. Recipe: Recording Video Using Built-In Intent
        8. Recipe: Recording Video Using Java Code
        9. Summary
    13. Part IV: Networking and Hardware Interface
      1. 12. Wireless Connectivity
        1. Recipe: Pairing Two Bluetooth-Enabled Devices
        2. Recipe: Manually Transferring Files from One Device to Another Using Bluetooth
        3. Recipe: Pairing a Bluetooth Device with a Windows PC
        4. Recipe: Enabling Local Bluetooth Device
        5. Recipe: Displaying the List of Paired Devices
        6. Recipe: Transferring Files Through Bluetooth
        7. Recipe: Understanding Wi-Fi
        8. Recipe: Enabling and Disabling Wi-Fi
        9. Recipe: Understanding Wi-Fi Direct
        10. Summary
      2. 13. Cores and Threads
        1. Recipe: Understanding the Utility of Multicore Processor Architectures
        2. Recipe: Understanding Utility of Garbage Collection
        3. Recipe: Understanding Threads
        4. Recipe: Using Multiple Threads
        5. Recipe: Using the AsyncTask Class
        6. Summary
      3. 14. Keyboards and Sensors
        1. Recipe: Changing Android Keyboards or Input Methods
        2. Recipe: Understanding Sensors
        3. Recipe: Knowing the List of Sensors Supported by the Device
        4. Recipe: Using the Accelerometer Sensor
        5. Recipe: Using the Proximity Sensor
        6. Recipe: Using Gyroscope Sensor
        7. Summary
    14. Part V: Exploring the Web
      1. 15. JSON
        1. Recipe: Understanding JSON
        2. Recipe: Using JSONObject to Keep Information
        3. Recipe: Nesting JSONObjects
        4. Recipe: Using JSONArray
        5. Recipe: Using JsonReader and JsonWriter
        6. Recipe: Consuming JSON Web Services in Android Apps
        7. Summary
      2. 16. WebViews
        1. Recipe: Understanding WebView and Its Methods
        2. Recipe: Displaying Web Pages Using WebView
        3. Recipe: Using the WebViewClient Class
        4. Recipe: Using the WebViewFragment
        5. Summary
    15. Part VI: Advanced Android Techniques
      1. 17. Adding Support for the Small Screen
        1. Recipe: Factors for Supporting Different Screens and Densities
        2. Recipe: Supporting Different Platform Versions
        3. Recipe: Supporting Older Versions Using the Android Support Library
        4. Recipe: Adapting to Screen Orientation by Anchoring Controls
        5. Recipe: Defining Alternate Layout to Handle Screen Orientation
        6. Summary
      2. 18. Home Screen Widgets
        1. Recipe: Understanding App Widgets and Home Screen Widgets
        2. Recipe: Knowing the App Widget Life Cycle Methods
        3. Recipe: Creating a Home Screen Widget
        4. Recipe: Updating the Home Screen Widget Through the Button Control
        5. Recipe: Using the AlarmManager to Frequently Update the Home Screen Widget
        6. Summary
      3. 19. Android Beam
        1. Recipe: Understanding Near Field Communication (NFC)
        2. Recipe: Understanding NFC Tags
        3. Recipe: Knowing the Structures Used in Exchanging Information with NFC Tags
        4. Recipe: Reading from NFC Tags
        5. Recipe: Writing into the NFC Tag
        6. Recipe: Using Android Beam
        7. Recipe: Transferring Data Using Android Beam
        8. Summary
      4. 20. Application Analytics and Tracking
        1. Recipe: Understanding Application Analytics and Tracking
        2. Recipe: Using the EasyTracker Library to Track an Android Application
        3. Recipe: Using the GoogleAnalytics Singleton to Track an Android Application
        4. Summary