Preface

When Google announced the development of Android, the field of mobile platforms was already well established. Even in the narrower category of open source platforms, a number of viable alternatives were being pushed by proponents. Yet Android has stimulated not only widespread technical interest but rampant speculation about its potential to completely transform the world of the personal device. Instead of a convenient prop to support a set of familiar functions, such as phone calls, email, and restaurant lookups, the electronic device could become an open-ended window into the whole world—could become, in short, anything that the user and the developer could think to make it.

How much of the cogent analysis and fervid hype will come to pass can be discussed elsewhere; this book is for those who want to get to know the programming environment for Android and learn what they themselves can do to make a difference. We have spent many grueling months investigating the source code over multiple releases and trying out the functions of the library and development kit. We have been working hard to uncover the true Android, going beyond any documentation we could find online or in print.

This book, read carefully, can enable any Java programmer to develop useful and robust applications for Android. It also takes you into the internals in some places, so you know how Android supports what you’re doing—and so you can play around with its open source code if you like.

Audience

This book is intended for experienced software developers who want to develop applications in the Android mobile environment. It assumes you have some experience with the Java programming language, with using Java to implement user interfaces, and that you are at least familiar with the technologies Android uses, such as XML, SQL, GTalk(XMPP), OpenGL-ES, and HTTP.

How This Book Is Organized

This book is organized around the core example program introduced in Chapter 2. Later chapters illustrate development techniques by adding to the example through implementing modular extensions, where this is feasible. Some chapters (and the Appendix A) cover more advanced topics that are not required for many applications.

Part I, gets you started with the basics you’ll need to write applications.

Chapter 1, Getting to Know Android, explains Android’s place in the market and its basic architecture.

Chapter 2, Setting Up Your Android Development Environment, tells you how to download the software you need, including Eclipse and the Android plug-in, and how to get started programming.

Chapter 3, Using the Android Development Environment for Real Applications, describes the files that make up a typical Android program.

Chapter 4, Under the Covers: Startup Code and Resources in the MJAndroid Application, looks at the fundamental Java code and XML resources that every application needs.

Chapter 5, Debugging Android Applications, introduces a number of tools for debugging and performance, including Eclipse, logs, the Android Debug Bridge (adb), DDMS, and Traceview.

Chapter 6, The ApiDemos Application, offers a high-level tour of the sample Android code included in the toolkit, with tips for exploring it yourself.

Chapter 7, Signing and Publishing Your Application, shows you how to make your application ready for public use.

Part II, explores in depth the major libraries you’ll need, and shows you how to use them effectively.

Chapter 8, Persistent Data Storage: SQLite Databases and Content Providers, shows how to use the two most powerful means in Android for storing and serving data.

Chapter 9, Location and Mapping, shows how to determine and display the user’s location, and how to use Google Maps.

Chapter 10, Building a View, introduces graphical programming on Android by explaining how to create and manipulate windows and views.

Chapter 11, A Widget Bestiary, covers the most popular and useful graphical interface elements provided by Android.

Chapter 12, Drawing 2D and 3D Graphics, shows how to lay out graphics, and delves into drawing, transforming, and animating your own graphics.

Chapter 13, Inter-Process Communication, covers Intents and Remote Methods, which allow you to access the functionality of other applications.

Chapter 14, Simple Phone Calls, shows how to dial a number from an application, and explains how Android carries out the request.

Chapter 15, Telephony State Information and Android Telephony Classes, shows how to get information about telephony service and phone calls, and offers a tour of telephony internals.

Appendix A, offers some background and history on wireless services.

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.

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: “Android Application Development by Rick Rogers, John Lombardo, Zigurd Mednieks, and Blake Meike. Copyright 2009 Rick Rogers, John Lombardo, Zigurd Mednieks, and Blake Meike, 978-0-596-52147-9.”

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

When you see a Safari® Books Online icon on the cover of your favorite technology book, that means the book is available online through the O’Reilly Network Safari Bookshelf.

Safari offers a solution that’s better than e-books. It’s a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it 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://www.oreilly.com/catalog/9780596521479

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

For more information about our books, conferences, Resource Centers, and the O’Reilly Network, see our website at:

http://www.oreilly.com

Acknowledgments

We’d like to thank Bill Dimmick, Brad O’Hearne, and Hycel Taylor for their thoughtful and careful reviews of this book under a high-pressure timeline.

Rick Rogers

Like anything worth doing, I suppose, this book ended up taking more time and effort than any of us planned in the beginning. I’d like to thank my coauthors and the great folks at O’Reilly for sticking with it and bringing the work to fruition, through all the twists and turns. I’d also like to thank my family and friends, who encouraged me all through the process, and lent an ear when I just needed to talk. Most especially, though, I want to dedicate the book to my wife, Susie, whose patience knows no bounds, and whose amazing attitude toward life is an enduring inspiration for me no matter what I’m doing.

John Lombardo

I would like to thank my wonderful wife, Dena, who kept life from interfering when I closed the office door to work on the book. I want to dedicate this book to my mother, Marguerite Megaris, who died suddenly in 2007. I gave her a copy of my first book, Embedded Linux (New Riders), back in 2001. She cracked it open to a page with some assembly code, looked at it for about 10 seconds, closed it, and said, “That’s nice, dear.” We had a good laugh over that. I’d also like to thank all the wonderful people at O’Reilly for all their hard work. I’d especially like to thank Andy Oram, who coddled and prodded us in just the right doses to keep the book humming along at a good clip.

Zigurd Mednieks

Thanks to Terry, Maija, and Charles for putting up with my schedule while I was writing, and to Andy Oram and my coauthors for letting me participate, and hopefully, contribute.

Blake Meike

I am very grateful to have been invited to work with such an amazing group of people. Thanks to Zigurd for suggesting it; Andy Oram for practically holding my pen; and Rick, John, and Isabel Kunkle for making those Thursday morning calls a pleasure. Thanks to Mike Morton for actually reading both the text and the code. Though it may seem obvious, thanks to the Google Android developers. Not bad guys. Not bad at all. Finally, love and thanks to my wife, Catherine, who never let me see any disappointment when I said, yet again, “Can’t. Gotta work on the book this weekend.” Yes, babe, let’s do the bookcase now.

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

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