WHO THIS BOOK IS FOR
This book is for anyone interested in creating applications for the Android platform. It includes information that will be valuable, whether you’re an experienced mobile developer or making your first foray, via Android, into writing mobile applications.
It will help if you have used smartphones (particularly phones running Android), but it’s not necessary, nor is prior experience in mobile application development.
It’s expected that you’ll have some experience in software development and be familiar with basic object-oriented development practices. An understanding of Java syntax is a requirement, and detailed knowledge and experience is a distinct advantage, though not a strict necessity.
Chapters 1 and 2 introduce mobile development and contain instructions to get you started in Android. Beyond that, there’s no requirement to read the chapters in order, although a good understanding of the core components described in Chapters 3–9 is important before you venture into the remaining chapters. Chapters 10 and 11 cover important details on how to create an application that provides a rich and consistent user experience, while Chapters 12–19 cover a variety of optional and advanced functionality and can be read in whatever order interest or need dictates.
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxvii
CHAPTER 1 Hello, Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
CHAPTER 2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
CHAPTER 3 Creating Applications and Activities . . . . . . . . . . . . . . . . . . . . . . . 53
CHAPTER 4 Building User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
CHAPTER 5 Intents and Broadcast Receivers . . . . . . . . . . . . . . . . . . . . . . . . . 165
CHAPTER 6 Using Internet Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
CHAPTER 7 Files, Saving State, and Preferences . . . . . . . . . . . . . . . . . . . . . . 221
CHAPTER 8 Databases and Content Providers . . . . . . . . . . . . . . . . . . . . . . . . 251
CHAPTER 9 Working in the Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
CHAPTER 10 Expanding the User Experience . . . . . . . . . . . . . . . . . . . . . . . . . . 359
CHAPTER 11 Advanced User Experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
CHAPTER 12 Hardware Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
CHAPTER 13 Maps, Geocoding, and Location-Based Services . . . . . . . . . . . 513
CHAPTER 14 Invading the Home Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
CHAPTER 15 Audio, Video, and Using the Camera . . . . . . . . . . . . . . . . . . . . . . 621
CHAPTER 16 Bluetooth, NFC, Networks, and Wi-Fi . . . . . . . . . . . . . . . . . . . . . . 665
CHAPTER 17 Telephony and SMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
CHAPTER 18 Advanced Android Development . . . . . . . . . . . . . . . . . . . . . . . . . 739
CHAPTER 19 Monetizing, Promoting, and Distributing Applications . . . . . . . .771
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787