Beginning Android™ Application Development

Book description

Create must-have applications for the latest Android OS

The Android OS is a popular and flexible platform for many of today's most in-demand mobile devices. This full-color guide offers you a hands-on introduction to creating Android applications for the latest mobile devices. Veteran author Wei Meng Lee accompanies each lesson with real-world examples to drive home the content he covers. Beginning with an overview of core Android features and tools, he moves at a steady pace while teaching everything you need to know to successfully develop your own Android applications.

  • Explains what an activity is and reviews its lifecycle

  • Zeroes in on customizing activities by applying styles and themes

  • Looks at the components of a screen, including LinearLayout, AbsoluteLayout, and RelativeLayout, among others

  • Details ways to adapt to different screen sizes and adjust display orientation

  • Reviews the variety of views such as TextView, ProgressBar, TimePicker, and more

Beginning Android Application Development pares down the most essential steps you need to know so you can start creating Android applications today.

Table of contents

  1. Copyright
  2. CREDITS
  3. ABOUT THE AUTHOR
  4. ABOUT THE TECHNICAL EDITOR
  5. ACKNOWLEDGMENTS
  6. INTRODUCTION
    1. WHO 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. Getting Started with Android Programming
    1. 1.1. WHAT IS ANDROID?
      1. 1.1.1. Android Versions
      2. 1.1.2. Features of Android
      3. 1.1.3. Architecture of Android
      4. 1.1.4. Android Devices in the Market
      5. 1.1.5. The Android Market
    2. 1.2. OBTAINING THE REQUIRED TOOLS
      1. 1.2.1. Eclipse
      2. 1.2.2. Android SDK
      3. 1.2.3. Android Development Tools (ADT)
      4. 1.2.4. Creating Android Virtual Devices (AVDs)
      5. 1.2.5. Creating Your First Android Application
      6. 1.2.6. Anatomy of an Android Application
    3. 1.3. SUMMARY
  8. 2. Activities and Intents
    1. 2.1. UNDERSTANDING ACTIVITIES
      1. 2.1.1. Applying Styles and Themes to Activity
      2. 2.1.2. Hiding the Activity Title
      3. 2.1.3. Displaying a Dialog Window
      4. 2.1.4. Displaying a Progress Dialog
    2. 2.2. LINKING ACTIVITIES USING INTENTS
      1. 2.2.1. Resolving Intent Filter Collision
      2. 2.2.2. Returning Results from an Intent
      3. 2.2.3. Passing Data Using an Intent Object
    3. 2.3. CALLING BUILT-IN APPLICATIONS USING INTENTS
      1. 2.3.1. Understanding the Intent Object
      2. 2.3.2. Using Intent Filters
      3. 2.3.3. Adding Categories
    4. 2.4. DISPLAYING NOTIFICATIONS
    5. 2.5. SUMMARY
  9. 3. Getting to Know the Android User Interface
    1. 3.1. UNDERSTANDING THE COMPONENTS OF A SCREEN
      1. 3.1.1. Views and ViewGroups
      2. 3.1.2. LinearLayout
      3. 3.1.3. AbsoluteLayout
      4. 3.1.4. TableLayout
      5. 3.1.5. RelativeLayout
      6. 3.1.6. FrameLayout
      7. 3.1.7. ScrollView
    2. 3.2. ADAPTING TO DISPLAY ORIENTATION
      1. 3.2.1. Anchoring Views
      2. 3.2.2. Resizing and Repositioning
    3. 3.3. MANAGING CHANGES TO SCREEN ORIENTATION
      1. 3.3.1. Persisting State Information during Changes in Configuration
      2. 3.3.2. Detecting Orientation Changes
      3. 3.3.3. Controlling the Orientation of the Activity
    4. 3.4. CREATING THE USER INTERFACE PROGRAMMATICALLY
    5. 3.5. LISTENING FOR UI NOTIFICATIONS
      1. 3.5.1. Overriding Methods Defined in an Activity
      2. 3.5.2. Registering Events for Views
    6. 3.6. SUMMARY
  10. 4. Designing Your User Interface Using Views
    1. 4.1. BASIC VIEWS
      1. 4.1.1. TextView View
      2. 4.1.2. Button, ImageButton, EditText, CheckBox, ToggleButton, RadioButton, and RadioGroup Views
      3. 4.1.3. ProgressBar View
      4. 4.1.4. AutoCompleteTextView View
    2. 4.2. PICKER VIEWS
      1. 4.2.1. TimePicker View
        1. 4.2.1.1. Displaying the TimePicker in a Dialog Window
      2. 4.2.2. DatePicker View
        1. 4.2.2.1. Displaying the DatePicker View in a Dialog Window
    3. 4.3. LIST VIEWS
      1. 4.3.1. ListView View
        1. 4.3.1.1. Customizing the ListView
      2. 4.3.2. Using the Spinner View
    4. 4.4. SUMMARY
  11. 5. Displaying Pictures and Menus with Views
    1. 5.1. USING IMAGE VIEWS TO DISPLAY PICTURES
      1. 5.1.1. Gallery and ImageView Views
      2. 5.1.2. ImageSwitcher
      3. 5.1.3. GridView
    2. 5.2. USING MENUS WITH VIEWS
      1. 5.2.1. Creating the Helper Methods
      2. 5.2.2. Options Menu
      3. 5.2.3. Context Menu
    3. 5.3. SOME ADDITIONAL VIEWS
      1. 5.3.1. AnalogClock and DigitalClock Views
      2. 5.3.2. WebView
    4. 5.4. SUMMARY
  12. 6. Data Persistence
    1. 6.1. SAVING AND LOADING USER PREFERENCES
      1. 6.1.1. Using getSharedPreferences()
      2. 6.1.2. Using getPreferences()
    2. 6.2. PERSISTING DATA TO FILES
      1. 6.2.1. Saving to Internal Storage
      2. 6.2.2. Saving to External Storage (SD Card)
      3. 6.2.3. Choosing the Best Storage Option
      4. 6.2.4. Using Static Resources
    3. 6.3. CREATING AND USING DATABASES
      1. 6.3.1. Creating the DBAdapter Helper Class
      2. 6.3.2. Using the Database Programmatically
        1. 6.3.2.1. Adding Contacts
        2. 6.3.2.2. Retrieving All the Contacts
        3. 6.3.2.3. Retrieving a Single Contact
        4. 6.3.2.4. Updating a Contact
        5. 6.3.2.5. Deleting a Contact
        6. 6.3.2.6. Upgrading the Database
      3. 6.3.3. Pre-Creating the Database
        1. 6.3.3.1. Bundling the Database with an Application
    4. 6.4. SUMMARY
  13. 7. Content Providers
    1. 7.1. SHARING DATA IN ANDROID
    2. 7.2. USING A CONTENT PROVIDER
      1. 7.2.1. Predefined Query String Constants
      2. 7.2.2. Projections
      3. 7.2.3. Filtering
      4. 7.2.4. Sorting
    3. 7.3. CREATING YOUR OWN CONTENT PROVIDERS
      1. 7.3.1. Using the Content Provider
    4. 7.4. SUMMARY
  14. 8. Messaging and Networking
    1. 8.1. SMS MESSAGING
      1. 8.1.1. Sending SMS Messages Programmatically
      2. 8.1.2. Getting Feedback after Sending the Message
      3. 8.1.3. Sending SMS Messages Using Intent
      4. 8.1.4. Receiving SMS Messages
        1. 8.1.4.1. Updating an Activity from a BroadcastReceiver
        2. 8.1.4.2. Invoking an Activity from a BroadcastReceiver
      5. 8.1.5. Caveats and Warnings
    2. 8.2. SENDING E-MAIL
    3. 8.3. NETWORKING
      1. 8.3.1. Downloading Binary Data
      2. 8.3.2. Downloading Text Files
      3. 8.3.3. Accessing Web Services
      4. 8.3.4. Performing Asynchronous Calls
    4. 8.4. SUMMARY
  15. 9. Location-Based Services
    1. 9.1. DISPLAYING MAPS
      1. 9.1.1. Creating the Project
      2. 9.1.2. Obtaining the Maps API Key
      3. 9.1.3. Displaying the Map
      4. 9.1.4. Displaying the Zoom Control
      5. 9.1.5. Changing Views
      6. 9.1.6. Navigating to a Specific Location
      7. 9.1.7. Adding Markers
      8. 9.1.8. Getting the Location That Was Touched
      9. 9.1.9. Geocoding and Reverse Geocoding
    2. 9.2. GETTING LOCATION DATA
      1. 9.2.1. Monitoring a Location
    3. 9.3. SUMMARY
  16. 10. Developing Android Services
    1. 10.1. CREATING YOUR OWN SERVICES
      1. 10.1.1. Performing Long-Running Tasks in a Service
      2. 10.1.2. Performing Repeated Tasks in a Service
      3. 10.1.3. Executing Asynchronous Tasks on Separate Threads Using IntentService
    2. 10.2. COMMUNICATING BETWEEN A SERVICE AND AN ACTIVITY
    3. 10.3. BINDING ACTIVITIES TO SERVICES
    4. 10.4. SUMMARY
  17. 11. Publishing Android Applications
    1. 11.1. PREPARING FOR PUBLISHING
      1. 11.1.1. Versioning
      2. 11.1.2. Digitally Signing Your Android Applications
    2. 11.2. DEPLOYING APK FILES
      1. 11.2.1. Using the adb.exe Tool
      2. 11.2.2. Using a Web Server
      3. 11.2.3. Publishing on the Android Market
        1. 11.2.3.1. Creating a Developer Profile
        2. 11.2.3.2. Submitting Your Apps
    3. 11.3. SUMMARY
  18. A. Using Eclipse for Android Development
    1. A.1. GETTING AROUND IN ECLIPSE
      1. A.1.1. Workspaces
      2. A.1.2. Package Explorer
      3. A.1.3. Using Projects from Other Workspaces
      4. A.1.4. Editors
      5. A.1.5. Perspectives
      6. A.1.6. Auto Import of Namespaces
      7. A.1.7. Code Completion
      8. A.1.8. Refactoring
    2. A.2. DEBUGGING
      1. A.2.1. Setting Breakpoints
      2. A.2.2. Exceptions
  19. B. Using the Android Emulator
    1. B.1. USES OF THE ANDROID EMULATOR
    2. B.2. INSTALLING CUSTOM AVDS
    3. B.3. EMULATING REAL DEVICES
    4. B.4. SD CARD EMULATION
    5. B.5. EMULATING DEVICES WITH DIFFERENT SCREEN SIZES
    6. B.6. EMULATING PHYSICAL CAPABILITIES
    7. B.7. SENDING SMS MESSAGES TO THE EMULATOR
    8. B.8. MAKING PHONE CALLS
    9. B.9. TRANSFERRING FILES INTO AND OUT OF THE EMULATOR
    10. B.10. RESETTING THE EMULATOR
  20. C. Answers to Exercises
    1. C.1. CHAPTER 1 ANSWERS
    2. C.2. CHAPTER 2 ANSWERS
    3. C.3. CHAPTER 3 ANSWERS
    4. C.4. CHAPTER 4 ANSWERS
    5. C.5. CHAPTER 5 ANSWERS
    6. C.6. CHAPTER 6 ANSWERS
    7. C.7. CHAPTER 7 ANSWERS
    8. C.8. CHAPTER 8 ANSWERS
    9. C.9. CHAPTER 9 ANSWERS
    10. C.10. CHAPTER 10 ANSWERS
    11. C.11. CHAPTER 11 ANSWERS

Product information

  • Title: Beginning Android™ Application Development
  • Author(s):
  • Release date: April 2011
  • Publisher(s): Wrox
  • ISBN: 9781118017111