Preface

The purpose of this book is to enable you to create well-engineered Android applications that go beyond the scope of small example applications.

This book is for people coming to Android programming from a variety of backgrounds. If you have been programming iPhone or Mac OS applications in Objective-C, you will find coverage of Android tools and Java language features relevant to Android programming that will help you bring your knowledge of mobile application development to Android. If you are an experienced Java coder, you will find coverage of Android application architecture that will enable you to use your Java expertise in this newly vibrant world of client Java application development. In short, this is a book for people with some relevant experience in object-oriented languages, mobile applications, REST applications, and similar disciplines who want to go further than an introductory book or online tutorials will take them.

How This Book Is Organized

We want to get you off to a fast start. The chapters in the first part of this book will step you through using the SDK tools so that you can access example code in this book and in the SDK, even as you expand your knowledge of SDK tools, Java, and database design. The tools and basics covered in the first part might be familiar enough to you that you would want to skip to Part II where we build foundational knowledge for developing larger Android applications.

The central part of this book is an example of an application that uses web services to deliver information to the user—something many applications have at their core. We present an application architecture, and a novel approach to using Android’s framework classes that enables you to do this particularly efficiently. You will be able to use this application as a framework for creating your own applications, and as a tool for learning about Android programming.

In the final part of this book, we explore Android APIs in specific application areas: multimedia, location, sensors, and communication, among others, in order to equip you to program applications in your specific area of interest.

By the time you reach the end of this book, we want you to have gained knowledge beyond reference material and a walk-through of examples. We want you to have a point of view on how to make great Android applications.

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, databases, data types, environment variables, statements, and keywords

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

Tip

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

Caution

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: “Programming Android, Second Edition by Zigurd Mednieks, Laird Dornin, G. Blake Meike, and Masumi Nakamura. Copyright 2012 O’Reilly Media, Inc., 978-1-449-31664-8.”

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 (www.safaribooksonline.com) is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.

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://oreil.ly/prog_android_2e.

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://www.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

The authors have adapted portions of this book from their previously released title, Android Application Development (O’Reilly).

Drafts of this book were released on the O’Reilly Open Feedback Publishing System (OFPS) in order to get your feedback on whether and how we are meeting the goals for this book. We are very grateful for the readers who participated in OFPS, and we owe them much in correcting our errors and improving our writing. Open review of drafts will be part of future editions, and we welcome your views on every aspect of this book.

Zigurd Mednieks

I am eternally grateful to Terry, my wife, and Maija and Charles, my children, who gave me the time to do this. This book exists because our agent, Carole Jelen, at Waterside Productions, whipped our proposal material into shape, and because Mike Hendrickson kicked off the project within O’Reilly. Brian Jepson and Andy Oram, our editors, kept this large troupe of authors unified in purpose and result. Thanks to Johan van der Hoeven, who provided review comments that contributed much to accuracy and clarity. Thanks to all the reviewers who used the Open Feedback Publishing System to help make this a better book.

Laird Dornin

Thanks to my wonderful Norah for encouraging me to take part in this project, even though you had no idea of the amount of effort involved in writing a book. Cheers to trips to Acadia, trips to New Hampshire, and late nights writing. I’m glad this book did not stall our truly important project, the arrival of our beautiful daughter Claire. Thanks to Andy our editor, and my coauthors for giving me this opportunity. Thanks to Larry for reviewing and enabling me to work on this project. I’m glad that ideas I developed at SavaJe could find a voice in this book. Finally, thanks to our main reviewers Vijay and Johan, you both found solid ways to improve the content.

G. Blake Meike

My thanks to our agent, Carole Jelen, Waterside Productions, without whom this book would never have been more than a good idea. Thanks, also, to editors Brian Jepson and Andy Oram, masters of the “gentle way.” Everyone who reads this book benefits from the efforts of Johan van der Hoeven and Vijay Yellapragada, technical reviewers; Sumita Mukherji, Adam Zaremba, and the rest of the O’Reilly production team; and all those who used O’Reilly’s OFPS to wade through early and nearly incomprehensible drafts, to produce salient comments and catch egregious errors. Thanks guys! Speaking of “thanks guys,” it was quite an honor and certainly a pleasure to collaborate with my coauthors, Zigurd, Laird, and Masumi. Of course, last, best, and as ever, thanks and love to my wife Catherine, who challenges me in the good times and provides support when it’s dark. Yeah, I know, the bookcase still isn’t done.

Masumi Nakamura

I would like to thank my friends and family for bearing with me as I worked on this and other projects. An especially big thank you to Jessamyn for dealing with me all these years. I also would like to thank Brian and Andy for getting us through the fine points of writing and publishing, as well as my coauthors for bringing me in to work on this piece. Also, a quick shout out to all the people at WHERE, Inc. who have been very supportive in my technological wanderings. Finally, a thank you to you, the readers, and all you developers working tirelessly to make Android a great platform to work on and enjoy using.

Get Programming Android, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.