Preface

This book sprang from years of delivering the Marakana Android Bootcamp training class to thousands of software developers at some of the largest mobile companies located on four continents around the world. Teaching this class, over time I saw what works and what doesn’t. This book is a distilled version of the Android Bootcamp training course that I developed at Marakana and fine-tuned over numerous engagements.

My background is in Java from back before it was even called that. From the beginning, I was very interested in embedded development as a way to program various devices that surround us in everyday life. Because Java primarily took off in web application development, most of my experience in the previous decade has been in building large enterprise systems. Then Android arrived, and once again I became very excited about building software for nontraditional computers. My current interests lie in using Android on devices that may not even resemble a typical phone.

This book teaches anyone who knows Java (or a similar language) how to develop a reasonably complex Android application. I hope you find this book fairly comprehensive and that you find the example-based learning reasonably motivating. The goal of Learning Android is to get you to think in Android terms.

What’s Inside

Chapter 1, Android Overview

Is an introduction to Android and its history

Chapter 2, The Stack

Is an overview of the Android operating system and all its parts from a very high level

Chapter 3, Quick Start

Helps you set up your environment for Android application development

Chapter 4, Main Building Blocks

Explains the Android components application developers use to put together an app

Chapter 5, Yamba Project Overview

Explains the Yamba application that we’ll build together through this book and use as an example to learn Android’s various features

Chapter 6, Android User Interface

Explains how to build the user interface for your application

Chapter 7, Preferences, the Filesystem, the Options Menu, and Intents

Covers some of the operating system features that make an application developer’s life easier

Chapter 8, Services

Covers building an Android service to process background tasks

Chapter 9, The Database

Explains the Android framework’s support for the built-in SQLite database and how to use it to persist the data in your own application

Chapter 10, Lists and Adapters

Covers an important feature of Android that allows large data sets to be linked efficiently to relatively small screens

Chapter 11, Broadcast Receivers

Explains how to use the publish-subscribe mechanism in Android to respond to various system and user-defined messages

Chapter 12, Content Providers

Shows how to design a content provider to share data between applications, in this case using it to enable our app widget to display data on the home screen

Chapter 13, System Services

Introduces various system services that an app developer can tap into

Chapter 14, The Android Interface Definition Language

Covers building an inter-process communication mechanism to allow for remote access to a service from another application

Chapter 15, The Native Development Kit (NDK)

Introduces how to write native C code as part of your Android application

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, data types, and XML entities.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Note

This icon signifies a tip, suggestion, or general note.

Warning

This icon indicates a warning or caution.

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Learning Android by Marko Gargenta (O’Reilly). Copyright 2011 Marko Gargenta, 978-1-449-39050-1.”

If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact us at .

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly.

With a subscription, you can read any page and watch any video from our library online. Read books on your cell phone and mobile devices. Access new titles before they are available for print, get exclusive access to manuscripts in development, and post feedback for the authors. Copy and paste code samples, organize your favorites, download chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other time-saving features.

O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other publishers, sign up for free at http://my.safaribooksonline.com.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707 829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://oreilly.com/catalog/9781449390501/

The author maintains a copy of the example code at the following site, as well:

https://github.com/marakana/LearningAndroidYamba

To comment or ask technical questions about this book, send email to:

For more information about our books, courses, conferences, and news, see our website at http://oreilly.com.

Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

This book is truly a result of outstanding teamwork. First, I’d like to thank my editors at O’Reilly, Andy Oram and Brian Jepson. Andy, your comments were spot-on and constructive. Brian, thank you for persuading me to take on writing this book in the first place.

I would like to thank all my technical editors: Dan Bornstein, Hervé Guihot, Frank Maker III, and Bill Schrickel. Thank you for diligently reading my half-baked drafts and providing valuable comments.

This book wouldn’t be what it is without field testing it on our numerous clients. You were the true pioneers on the cutting edge of Android, and your projects are all very inspiring. Thank you for your trust.

I’d like to thank my team at Marakana—Aleksandar (Saša) Gargenta, Ken Jones, and Laurent Tonon—for bringing back firsthand feedback from teaching Android Bootcamp courses using the draft of this book. Saša, special thanks to you for sending me back to the drawing board more times than I’d like to admit. This book is probably months past due because of your in-depth technical comments.

And finally, a huge thanks to my wife, Lisa, and daughter, Kylie. I know what a sacrifice it was for you while I was crisscrossing the world working on this material. Thank you for supporting me along the way.

Get Learning Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.