Android in Action, Second Edition
W. Frank Ableson, Robi Sen, and Chris King
  • January 2011
  • ISBN 9781935182726
  • 592 pages
  • printed in black & white
This title is out of print and no longer for sale.

A deep dive into Android 2. Outstanding!

Frank Wang, Digital Velocity LLC

Third edition of this book is available

When it comes to mobile apps, Android can do almost anything&mdash:and with this book, so can you! Android runs on mobile devices ranging from smart phones to tablets to countless special-purpose gadgets. It's the broadest mobile platform available.

Android in Action, Second Edition is a comprehensive tutorial for Android developers. Taking you far beyond "Hello Android," this fast-paced book puts you in the driver's seat as you learn important architectural concepts and implementation strategies. You'll master the SDK, build WebKit apps using HTML 5, and even learn to extend or replace Android's built-in features by building useful and intriguing examples.

Table of Contents show full

preface xvii

preface to the first edition xix

acknowledgments xxi

about this book xxiv

about the cover illustration xxix

Part 1 What is Android?—The Big Picture

1. Chapter 1 Introducing Android

1.1. The Android platform

1.2. Understanding the Android market

1.3. The layers of Android

1.4. The Intent of Android development

1.5. Four kinds of Android components

1.6. Understanding the AndroidManifest.xml file

1.7. Mapping applications to processes

1.8. Creating an Android application

1.9. Summary

2. Chapter 2 Android’s development environment

2.1. Introducing the Android SDK

2.2. Exploring the development environment

2.3. Building an Android application in Eclipse

2.4. Using the Android emulator

2.5. Debugging your application

2.6. Summary

Part 2 Exercising the Android SDK

3. Chapter 3 User interfaces

3.1. Creating the Activity

3.2. Working with views

3.3. Using resources

3.4. Exploring the AndroidManifest file

3.5. Summary

4. Chapter 4 Intents and Services

4.1. Serving up RestaurantFinder with Intent

4.2. Checking the weather with a custom URI

4.3. Checking the weather with broadcast receivers

4.4. Building a background weather service

4.5. Communicating with the WeatherAlertService from other apps

4.6. Summary

5. Chapter 5 Storing and retrieving data

5.1. Using preferences

5.2. Using the filesystem

5.3. Persisting data to a database

5.4. Working with ContentProvider classes

5.5. Summary

6. Chapter 6 Networking and web services

6.1. An overview of networking

6.2. Checking the network status

6.3. Communicating with a server socket

6.4. Working with HTTP

6.5. Web services

6.6. Summary

7. Chapter 7 Telephony

7.1. Exploring telephony background and terms

7.2. Accessing telephony information

7.3. Interacting with the phone

7.4. Working with messaging: SMS

7.5. Summary

8. Chapter 8 Notifications and alarms

8.1. Introducing Toast

8.2. Introducing notifications

8.3. Introducing Alarms

8.4. Summary

9. Chapter 9 Graphics and animation

9.1. Drawing graphics in Android

9.2. Creating animations with Android’s Graphics API

9.3. Introducing OpenGL for Embedded Systems

9.4. Summary

10. Chapter 10 Multimedia

10.1. Introduction to multimedia and OpenCORE

10.2. Playing audio

10.3. Playing video

10.4. Capturing media

10.5. Recording video

10.6. Summary

11. Chapter 11 Location, location, location

11.1. Simulating your location within the emulator

11.2. Using LocationManager and LocationProvider

11.3. Working with maps

11.4. Converting places and addresses with Geocoder

11.5. Summary

Part 3 Android applications

12. Chapter 12 Putting Android to work in a field service application

12.1. Designing a real-world Android application

12.2. Mapping out the application flow

12.3. Application source code

12.4. Source code for managing jobs

12.5. Server code

12.6. Summary

13. Chapter 13 Building Android applications in C

13.1. Building Android apps without the SDK

13.2. Solving the problem with dynamic linking

13.3. What time is it? The DayTime Server2

13.4. Daytime Client

13.5. Summary

Part 4 The maturing platform

14. Chapter 14 Bluetooth and sensors

14.1. Exploring Android’s Bluetooth capabilities

14.2. Interacting with the SensorManager

14.3. Building the SenseBot application

14.4. Summary

15. Chapter 15 Integration

15.1. Understanding the Android contact model

15.2. Getting started with LinkedIn

15.3. Managing contacts

15.4. Keeping it together

15.5. Creating a LinkedIn account

15.6. Synchronizing to the backend with SyncAdapter

15.7. Wrapping up: LinkedIn in action

15.8. Summary

16. Chapter 16 Android web development

16.1. What’s Android web development?

16.2. Optimizing web applications for Android

16.3. Storing data directly in the browser

16.4. Building a hybrid application

16.5. Summary

17. Chapter 17 AppWidgets

17.1. Introducing the AppWidget

17.2. Introducing SiteMonitor

17.3. SiteMonitor application architecture

17.4. AppWidget data handling

17.5. Implementing the AppWidgetProvider

17.6. Displaying an AppWidget with RemoteViews

17.7. Configuring an instance of the AppWidget

17.8. Updating the AppWidget

17.9. Tying it all together with AndroidManifest.xml

17.10. Summary

18. Chapter 18 Localization

18.1. The need for localization

18.2. Exploring locales

18.3. Strategies for localizing an application

18.4. Leveraging Android resource capabilities

18.5. Localizing in Java code

18.6. Formatting localized strings

18.7. Obstacles to localization

18.8. Summary

19. Chapter 19 Android Native Development Kit

19.1. Introducing the NDK

19.2. Building an application with the NDK

19.3. Building the JNI library

19.4. Building the user interface

19.5. Integrating the NDK into Eclipse

19.6. Summary

Appendix A: Installing the Android SDK

Appendix B: Publishing applications

index

© 2014 Manning Publications Co.

What's inside

  • Android 2 from the ground up
  • SDK and web development
  • Drive a robot via Bluetooth and Sensors
  • Integrate with Social Media Contacts
  • Image processing with native C code

About the reader

This book is written for hobbyists and developers. A background in Java is helpful—no prior experience with Android is assumed.

About the authors

Frank Ableson is a writer, product strategist, and mobile developer. Robi Sen specializes in new products, and Chris King is a senior mobile engineer.