Table of Contents

Copyright

Brief Table of Contents

Table of Contents

Preface

Acknowledgments

About this Book

About the Cover Illustration

1. Background and fundamentals

Chapter 1. Introducing Android

1.1. Android in a nutshell

1.1.1. Defining Android

1.1.2. What sets Android apart

1.1.3. Key platform components

1.2. Hello Android!

1.2.1. Getting the SDK and Eclipse

1.2.2. Creating an Android project with Eclipse

1.2.3. Project structure

1.2.4. Introducing the Activity class

1.2.5. Setting the Activity layout

1.2.6. Referring to resources

1.2.7. Project wiring: the manifest

1.2.8. Running and debugging Hello Android

1.3. Java, but not Java Java

1.3.1. Built on Harmony

1.3.2. Packages and libraries included

1.3.3. The Dalvik virtual machine

1.4. Linux, but not Linux Linux

1.4.1. Is Android Linux?

1.4.2. Storage devices and the file system

1.4.3. User accounts and file permissions

1.4.4. Processes and multitasking

1.5. More capabilities with native libraries

1.5.1. Audio and video processing

1.5.2. Storage engine

1.5.3. Web integration

1.5.4. Sensors, camera, and more

1.6. Tools of the trade

1.6.1. Android-specific APIs

1.6.2. SDK tools and components

1.7. Summary

Chapter 2. Android application fundamentals

2.1. The DealDroid application

2.2. Core building blocks

2.3. Application manifest

2.3.1. Permissions

2.4. Resources

2.4.1. Defining resources

2.4.2. Accessing resources

2.5. Layout, views, and widgets

2.5.1. Declaring layouts

2.5.2. Views and widgets

2.6. Activities

2.6.1. Activity basics

2.6.2. List-based activities

2.7. Adapters

2.7.1. Adapter basics

2.7.2. Custom adapters

2.8. Intents and IntentFilters

2.8.1. Using intents

2.8.2. Intent types

2.8.3. Intent resolution

2.9. The Application object

2.10. Summary

Chapter 3. Managing lifecycle and state

3.1. Defining an Android application

3.1.1. Application lifecycle

3.1.2. Application user ID, process, and threads

3.2. Knowing the Activity lifecycle

3.2.1. Lifecycle phases and methods

3.2.2. The lifecycle in action

3.2.3. Configuration changes

3.3. Controlling Activity instance state

3.3.1. Saving and restoring instance state

3.3.2. Using nonconfiguration instance state

3.4. Getting things done within a task

3.4.1. Defining a task

3.4.2. Stacking activities within a task

3.4.3. Understanding activity task affinity

3.5. Summary

2. Real world recipes

Chapter 4. Getting the pixels perfect

4.1. The MyMovies application

4.2. View hierarchies and rendering

4.2.1. View hierarchies

4.2.2. View rendering

4.3. Arranging views in layouts

4.3.1. Layout anatomy

4.3.2. Layout managers

Technique 1: The merge and include directives

4.4. Expanding on ListView and Adapter

Technique 2: Managing a stateful list

Technique 3: Header and footer views

4.5. Applying themes and styles

4.5.1. Styling applications

Technique 4: Applying and writing styles

Technique 5: Applying and writing themes

Technique 6: Styling ListView backgrounds

4.5.2. Useful styling tidbits

4.6. Working with drawables

4.6.1. Drawable anatomy

Technique 7: Working with shape drawables

Technique 8: Working with selector drawables

Technique 9: Scaling views with nine-patch drawables

4.7. Creating portable user interfaces

Technique 10: Automatically scaling to different screens

Technique 11: Loading configuration dependent resources

Technique 12: Programming pixel-independently

4.8. Summary

Chapter 5. Managing background tasks with Services

5.1. It’s all about the multitasking

5.2. Why services and how to use them

Technique 13: Creating a Service

Technique 14: Starting a Service automatically

Technique 15: Communicating with a Service

Technique 16: Using a Service for caching data

Technique 17: Creating notifications

5.3. Scheduling and Services

Technique 18: Using the AlarmManager

Technique 19: Keeping Services awake

Technique 20: Using Cloud to Device Messaging

5.4. Summary

Chapter 6. Threads and concurrency

6.1. Concurrency in Android

Technique 21: Basic threading

Technique 22: Communicating change between threads

Technique 23: Managing threads in thread pools

6.2. Working with AsyncTask

Technique 24: Implementing jobs with AsyncTask

Technique 25: Preparing for configuration changes

6.3. Miscellaneous techniques

Technique 26: Displaying splash screens with timers

Technique 27: Implementing custom message loops

6.4. Summary

Chapter 7. Storing data locally

7.1. Reading and writing files

7.1.1. Internal versus external storage

Technique 28: Using internal storage

Technique 29: Using external storage

Technique 30: Using cache directories

Technique 31: Making sure files are saved with sync

7.2. Maintaining preferences

Technique 32: Reading and writing preference data

Technique 33: Using a PreferenceActivity

7.3. Working with a database

7.3.1. Android data packages

7.3.2. Designing a data access layer

Technique 34: Creating a database and model objects

Technique 35: Creating DAOs and a data manager

7.4. Inspecting SQLite databases

Sqlite Shell

SQLiteManager

7.5. Summary

Chapter 8. Sharing data between apps

8.1. Process-to-process sharing

Technique 36: Using Intents

Technique 37: Making remote procedure calls

Technique 38: Share data (and more) by sharing Context

8.2. Accessing common data

Technique 39: Using standard ContentProviders

Technique 40: Working with a custom ContentProvider

8.3. Summary

Chapter 9. HTTP networking and web services

9.1. Basic HTTP networking

Technique 41: HTTP with HttpURLConnection

Technique 42: HTTP with Apache HttpClient

Technique 43: Configuring a thread-safe HttpClient

9.2. Consuming XML and JSON web services

Technique 44: Parsing XML with SAX

Technique 45: Parsing XML with XmlPull

Technique 46: Parsing JSON

9.3. How to gracefully recover from network failures

Technique 47: Retrying requests using request-retry handlers

Technique 48: Handling network configuration changes

9.4. Summary

Chapter 10. Location is everything

10.1. A brief introduction to geospatial coordinates

10.1.1. Latitude and longitude

10.1.2. Potential issues to look for

10.1.3. Other metrics

10.2. Location managers, providers, and listeners

10.2.1. Checking in with the LocationManager

10.2.2. Using a LocationProvider

10.2.3. Using a LocationListener

Technique 49: Checking the status of a LocationProvider

Technique 50: Determining current location with a LocationListener

10.3. Building a map-based application

10.3.1. Getting the Google APIs Add-On extension

10.3.2. Setting up BrewMap

Technique 51: Converting an address to geographical coordinates

10.3.3. Working with MapActivity

Technique 52: Creating a MapActivity with associated MapView

10.3.4. Using a map Overlay

Technique 53: Displaying OverlayItems on a MapView

10.4. Summary

Chapter 11. Appeal to the senses using multimedia

11.1. Features too good for a feature phone

Technique 54: Detecting capabilities

11.2. Managing media

Technique 55: Working with resources and files

Technique 56: Using media ContentProviders

Technique 57: Using Intents and Activities

11.3. Media playback

Technique 58: Images and simple animations

Technique 59: Controlling audio

Technique 60: Watching video

11.4. Capturing input

Technique 61: Taking pictures

Technique 62: Recording audio and video

11.5. Summary

Chapter 12. 2D and 3D drawing

12.1. Drawing with the 2D libraries

12.1.1. Introducing the Canvas

Technique 63: Going full screen

Technique 64: Drawing simple shapes

Technique 65: Rendering continuously in the UI thread

Technique 66: Drawing text to the screen

Technique 67: Using a typeface when drawing text

Technique 68: Displaying bitmaps

Technique 69: Applying 2D effects

12.2. 3D and OpenGL ES

12.2.1. What is OpenGL?

12.2.2. How OpenGL ES works

12.2.3. Creating an OpenGL project

Technique 70: Drawing the first triangle

Technique 71: Creating a pyramid

Technique 72: Coloring the pyramid

Technique 73: Adding texture to the pyramid

12.3. Summary

3. Beyond standard development

Chapter 13. Testing and instrumentation

13.1. Testing the Android

13.1.1. Ways to test in Android

13.1.2. Organizing tests

13.1.3. Writing and running tests

Technique 74: A simple Android unit test

13.2. Pulling strings: Android instrumentation

Technique 75: Unit testing Activities

Technique 76: User stories as functional tests

Technique 77: Beautiful tests with Robotium

13.3. Beyond instrumentation: mocks and monkeys

Technique 78: Mock objects and how to use them

Technique 79: Accelerating unit tests with Robolectric

Technique 80: Stressing out with the Monkey

13.4. Summary

Chapter 14. Build management

14.1. Building Android applications

14.1.1. The Android build process

14.1.2. Moving toward automated builds

Technique 81: Building with Ant

14.2. Managing builds with Maven

Technique 82: Building with Maven

Technique 83: The Maven Eclipse plugin

Technique 84: The Maven/Android SDK deployer

14.3. Build servers and continuous builds

Technique 85: Continuous builds with Hudson

Technique 86: Matrix builds

14.4. Summary

Chapter 15. Developing for Android tablets

15.1. Tablet prep

Technique 87: Leveraging existing code using library projects

Technique 88: Targeting only tablets

15.2. Tablet fundamentals

Technique 89: Fragments

Technique 90: The Action Bar

Technique 91: Drag and Drop

15.3. Summary

Appendix A. Debugging tools of the trade

A.1. The Android Debug Bridge

A.1.1. Interacting with devices

A.1.2. Using the device shell

A.1.3. Controlling Android’s execution environment

A.1.4. Accessing the system logs

A.2. StrictMode

A.3. Summary

Appendix B. Extending Android development

B.1. Using WebViews and JavaScript

B.2. Alternative programming languages

Appendix C. ProGuard

C.1. Overview

C.2. Enabling ProGuard

C.3. Writing ProGuard rules

C.4. Useful rules and options

C.4.1. Useful rules

C.4.2. Useful options

C.5. Processing error reports

C.6. Summary

Appendix D. monkeyrunner

D.1. Overview

D.2. Components and features

D.2.1. MonkeyRunner

D.2.2. MonkeyDevice

D.2.3. MonkeyImage

D.3. Scripting monkeyrunner

D.4. Writing plugins

D.5. Summary

Index

List of Figures

List of Tables

List of Listings

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.136.235