Android Application Development

Book description

This practical book provides the concepts and code you need to develop software with Android, the open-source platform for cell phones and mobile devices that's generating enthusiasm across the industry. Based on the Linux operating system and developed by Google and the Open Handset Alliance, Android has the potential to unite a fragmented mobile market. Android Application Development introduces this programming environment, and offers you a complete working example that demonstrates Android architectural features and APIs. With this book, you will:

  • Get a complete introduction to the Android programming environment, architecture, and tools
  • Build a modular application, beginning with a core module that serves to launch modules added in subsequent chapters
  • Learn the concepts and architecture of a specific feature set, including views, maps, location-based services, persistent data storage, 2D and 3D graphics, media services, telephony services, and messaging
  • Use ready-to-run example code that implements each feature
  • Delve into advanced topics, such as security, custom views, performance analysis, and internationalization

The book is a natural complement to the existing Android documentation provided by Google. Whether you want to develop a commercial application for mobile devices, or just want to create a mobile mashup for personal use, Android Application Development demonstrates how you can design, build, and test applications for the new mobile market.

Table of contents

  1. A Note Regarding Supplemental Files
  2. Preface
    1. Audience
    2. How This Book Is Organized
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Books Online
    6. How to Contact Us
    7. Acknowledgments
      1. Rick Rogers
      2. John Lombardo
      3. Zigurd Mednieks
      4. Blake Meike
  3. I. Development Kit Walk-Through
    1. 1. Getting to Know Android
      1. Why Android?
      2. The Open Handset Alliance
      3. The Android Execution Environment
      4. Components of an Android Application
      5. Android Activity Lifecycle
      6. Android Service Lifecycle
      7. How This Book Fits Together
    2. 2. Setting Up Your Android Development Environment
      1. Setting Up Your Development Environment
        1. Creating an Android Development Environment
      2. Hello, Android
        1. Where We’re Going
        2. Starting a New Android Application: HelloWorld
        3. Writing HelloWorld
        4. Running HelloWorld
    3. 3. Using the Android Development Environment for Real Applications
      1. MicroJobs: This Book’s Main Sample Application
      2. Android and Social Networking
      3. Downloading the MJAndroid Code
      4. A Brief Tour of the MJAndroid Code
        1. The Project Root Folder (MJAndroid)
        2. The Source Folder (src)
        3. The Resource Folder (res)
      5. First Steps: Building and Running the MicroJobs Application
        1. A Very Short Tour of the Android SDK/Eclipse IDE
        2. Loading and Starting the Application
        3. Digging a Little Deeper: What Can Go Wrong?
        4. Running an Application on the T-Mobile Phone
          1. Enable USB debugging on your phone
          2. Load the USB driver for ADB
          3. Connecting the phone
          4. Running MicroJobs on the phone
      6. Summary
    4. 4. Under the Covers: Startup Code and Resources in the MJAndroid Application
      1. Initialization Parameters in AndroidManifest.xml
      2. Initialization in
        1. More Initialization of
      3. Summary
    5. 5. Debugging Android Applications
      1. The Tools
      2. Eclipse Java Editor
        1. Java Errors
        2. The Debugger
        3. Logcat
          1. Looking at logcat to solve runtime errors
          2. Writing your own logcat entries
        4. Android Debug Bridge (adb)
        5. DDMS: Dalvik Debug Monitor Service
        6. Traceview
          1. Trace data collection
      3. Summary
    6. 6. The ApiDemos Application
      1. Application Setup in the Manifest File
      2. Finding the Source to an Interesting Example
        1. Custom Title Demo
        2. Linkify Demo
      3. Adding Your Own Examples to ApiDemos
    7. 7. Signing and Publishing Your Application
      1. Test Your Application
      2. Attach an End User License Agreement If Desired
      3. Create and Attach an Icon and Label
      4. Clean Up for Release
      5. Version Your Application
      6. Obtaining a Signing Certificate and API Key
        1. Getting a Signing Certificate for an Application You Are Going to Ship
          1. Generating a key pair (public and private keys) and a signing certificate
        2. Getting a Signing Certificate While Debugging
          1. Getting the MD5 fingerprint of your Debug signing certificate
          2. Getting a Map API Key from Google
      7. Signing Your Application
      8. Retesting Your Application
      9. Publishing on Android Market
        1. Signing Up As an Android Developer
        2. Uploading Your Application
  4. II. Programming Topics
    1. 8. Persistent Data Storage: SQLite Databases and Content Providers
      1. Databases
        1. Basic Structure of the MicroJobsDatabase Class
        2. Reading Data from the Database
        3. Modifying the Database
          1. Inserting data into the database
          2. Updating data already in the database
          3. Deleting data in the database
      2. Content Providers
        1. Introducing NotePad
          1. Activities
          2. Database
          3. Structure of the source code
        2. Content Providers
          1. Implementing a content provider
            1. Extend ContentProvider
            2. NotePadProvider class and instance variables
            3. Define CONTENT_URI
            4. Create the data storage
            5. Create the column names
            6. Supporting binary data
            7. Declare column specification strings
            8. Implement the Cursor
            9. Create data (insert)
            10. Read/select data (query)
            11. Update data
            12. Delete data
            13. Updating AndroidManifest.xml
            14. Define MIME types
        3. Consuming a Content Provider
          1. Create data (insert)
          2. Read/query data
          3. Update data
          4. Delete data
    2. 9. Location and Mapping
      1. Location-Based Services
      2. Mapping
      3. The Google Maps Activity
      4. The MapView and MapActivity
      5. Working with MapViews
        1. MapView and MyLocationOverlay Initialization
        2. Pausing and Resuming a MapActivity
        3. Controlling the Map with Menu Buttons
        4. Controlling the Map with the KeyPad
      6. Location Without Maps
        1. The Manifest and Layout Files
        2. Connecting to a Location Provider and Getting Location Updates
        3. Updating the Emulated Location
          1. Using geo to update location
          2. Using DDMS to update location
    3. 10. Building a View
      1. Android GUI Architecture
        1. The Model
        2. The View
        3. The Controller
        4. Putting It Together
      2. Assembling a Graphical Interface
      3. Wiring Up the Controller
        1. Listening to the Model
        2. Listening for Touch Events
        3. Listening for Key Events
        4. Alternative Ways to Handle Events
        5. Advanced Wiring: Focus and Threading
      4. The Menu
    4. 11. A Widget Bestiary
      1. Android Views
        1. TextView and EditText
        2. Button and ImageButton
        3. Adapters and AdapterViews
        4. CheckBoxes, RadioButtons, and Spinners
      2. ViewGroups
        1. Gallery and GridView
        2. ListView and ListActivity
        3. ScrollView
        4. TabHost
      3. Layouts
        1. Frame Layout
        2. LinearLayout
        3. TableLayout
        4. AbsoluteLayout
        5. RelativeLayout
    5. 12. Drawing 2D and 3D Graphics
      1. Rolling Your Own Widgets
        1. Layout
          1. Measurement
          2. Arrangement
        2. Canvas Drawing
          1. Drawing text
          2. Matrix transformations
        3. Drawables
        4. Bitmaps
      2. Bling
        1. Shadows, Gradients, and Filters
        2. Animation
          1. Transition animation
          2. Background animation
          3. Surface view animation
        3. OpenGL Graphics
    6. 13. Inter-Process Communication
      1. Intents: Simple, Low-Overhead IPC
        1. Intent Objects Used in Inter-Process Communication
        2. Activity Objects and Navigating the User Interface Hierarchy
        3. Example: An Intent to Pick How We Say “Hello World”
        4. Getting a Result via Inter-Process Communication
      2. Remote Methods and AIDL
        1. Android Interface Definition Language
        2. Classes Underlying AIDL-Generated Interfaces
          1. Implementing the Stub interface
          2. Getting an instance of the remote Proxy object
        3. Publishing an Interface
        4. Android IPC Compared with Java Native Interface (JNI)
        5. What Binder Doesn’t Do
        6. Binder and Linux
    7. 14. Simple Phone Calls
      1. Quick and Easy Phone Calls
        1. Creating an Example Application to Run the call Method
        2. Embedding the Code Snippet in a Simple Application
      2. Exploring the Phone Code Through the Debugger
        1. Creating an Instance of an Intent
        2. Adding Data to an Instance of an Intent
        3. Initiating a Phone Call
      3. Exception Handling
      4. Android Application-Level Modularity and Telephony
    8. 15. Telephony State Information and Android Telephony Classes
      1. Operations Offered by the android.telephony Package
        1. Package Summary
        2. Limitations on What Applications Can Do with the Phone
        3. Example: Determining the State of a Call
      2. Android Telephony Internals
        1. Inter-Process Communication and AIDL in the android.internal.telephony Package
        2. The android.internal.telephony Package
        3. The android.internal.telephony.gsm Package
        4. Exploring Android Telephony Internals
      3. Android and VoIP
  5. A. Wireless Protocols
    1. Prehistory
    2. The Dawn of Second Generation (2G) Digital Cellular
    3. Improved Digital Cellular (2.5G)
    4. The Rise of 3G
    5. The Future: 4G
  6. Index
  7. About the Authors
  8. Colophon
  9. Copyright

Product information

  • Title: Android Application Development
  • Author(s): Rick Rogers, John Lombardo, Zigurd Mednieks, G. Blake Meike
  • Release date: May 2009
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596521479