Beginning Android

Mark L. Murphy

About the Author

MARK MURPHY is the founder of CommonsWare and the author of the Busy Coder’s Guide to Android Development. A three-time entrepreneur, his experience ranges from consulting on open source and collaborative development for the Fortune 500 to application development on just about anything smaller than a mainframe. He has been a software developer for over 25 years, from the TRS-80 to the latest crop of mobile devices. A polished speaker, Mr. Murphy has delivered conference presentations and training sessions on a wide array of topics internationally.

Mr. Murphy writes the Building ‘Droids column for AndroidGuys and the Android Angle column for NetworkWorld.

Outside of CommonsWare, Mr. Murphy has an avid interest in how the Internet will play a role in citizen involvement with politics and government. He is also a contributor to the Rebooting America essay collection.

Acknowledgments

I would like to thank the Android team, not only for putting out a good product, but for invaluable assistance on the Android Google Groups. In particular, I would like to thank Romain Guy, Justin Mattson, Dianne Hackborn, Jean-Baptiste Queru, Jeff Sharkey, and Xavier Ducrohet.

Icons used in the sample code were provided by the Nuvola[1] icon set.

Introduction

Welcome to the Book!

Thanks for your interest in developing applications for Android! Increasingly, people will access Internet- based services using so-called “non-traditional” means, such as mobile devices. The more we do in that space now, the more that people will help invest in that space to make it easier to build more powerful mobile applications in the future. Android is new — Android-powered devices appeared on the scene first in late 2008 — but it likely will rapidly grow in importance due to the size and scope of the Open Handset Alliance.

Most of all, thanks for your interest in this book! I sincerely hope you find it useful and at least occasionally entertaining.

Prerequisites

If you are interested in programming for Android, you will need at least basic understanding of how to program in Java. Android programming is done using Java syntax, plus a class library that resembles a subset of the Java SE library (plus Android-specific extensions). If you have not programmed in Java before, you probably should learn how that works before attempting to dive into programming for Android.

The book does not cover in any detail how to download or install the Android development tools, either the Eclipse IDE flavor or the standalone flavor. The Android Web site[2] covers this quite nicely. The material in the book should be relevant whether you use the IDE or not. You should download, install, and test out the Android development tools from the Android Web site before trying any of the examples listed in this book.

Editions of This Book

This book is being produced via a partnership between Apress and CommonsWare. You are reading the Apress edition, which is available in print and in digital form from various digital book services.

CommonsWare continually updates the original material and makes it available to members of its Warescription program, under the title The Busy Coder’s Guide to Android Development.

CommonsWare maintains a FAQ about this partnership at http://commonsware.com/apress.

Source Code License

The source code samples shown in this book are available for download from the Apress Web site.[3] All of the Android projects are licensed under the Apache 2.0 License[4], in case you have the desire to reuse any of it.

PART 1

Core Concepts 

CHAPTER 1

The Big Picture

Android devices, by and large, will be mobile phones. While the Android technology is being discussed for use in other areas (e.g., car dashboard “PCs”), for the most part, you can think of Android as being used on phones.

For developers, this has benefits and drawbacks.

On the plus side, circa 2009, Android-style smartphones are sexy. Offering Internet services over mobile devices dates back to the mid-1990s and the Handheld Device Markup Language (HDML). However, only in recent years have phones capable of Internet access taken off. Now, thanks to trends like text messaging and to products like Apple’s iPhone, phones that can serve as Internet access devices are rapidly gaining popularity. So, working on Android applications gives you experience with an interesting technology (Android) in a fast-moving market segment (Internet-enabled phones), which is always a good thing.

The problem comes when you actually have to program the darn things.

Anyone with experience in programming for PDAs or phones has felt the pain of phones simply being small in all sorts of dimensions:

• Screens are small (you won’t get comments like, “Is that a 24-inch LCD in your pocket, or …?”).

• Keyboards, if they exist, are small.

• Pointing devices, if they exist, are annoying (as anyone who has lost their stylus will tell you) or inexact (large fingers and “multi-touch” LCDs are not a good mix).

• CPU speed and memory are tight compared to desktops and servers you may be used to.

• You can have any programming language and development framework you want, so long as it was what the device manufacturer chose and burned into the phone’s silicon.

• And, so on … 

Moreover, applications running on a phone have to deal with the fact that they’re on a phone.

People with mobile phones tend to get very irritated when their phones don’t work, which is why the “Can you hear me now?” ad campaign from Verizon Wireless has been popular for the past few years. Similarly, those

Вы читаете Beginning Android
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату