Home > Store

Sams Teach Yourself Android Application Development in 24 Hours

Register your product to gain access to bonus material or receive a coupon.

Sams Teach Yourself Android Application Development in 24 Hours


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2010
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-67335-2
  • ISBN-13: 978-0-321-67335-0


In just 24 sessions of one hour or less, learn how to build powerful applications for the world’s first complete, open, and free mobile platform: Android. Using this book’s straightforward, step-by-step approach, you’ll build a fully-featured Android application from the ground up and master the skills you need to design, develop, test, and publish powerful applications. Each lesson builds on what you’ve already learned, giving you a rock-solid foundation for real-world success!

Step-by-step instructions carefully walk you through the most common Android development tasks.

Quizzes and Exercises at the end of each chapter help you test your knowledge.

By the Way notes present interesting information related to the discussion.

Did You Know? tips offer advice or show you easier ways to perform tasks.

Watch Out! cautions alert you to possible problems and give you advice on how to avoid them.

Learn how to…

  • Develop Android applications quickly and successfully with Java
  • Master Google’s Android SDK and development tools
  • Leverage the Eclipse programming environment to develop Android projects
  • Understand the Android application lifecycle
  • Build effective, user-friendly user interfaces
  • Retrieve, store, and work with application data
  • Develop powerful network applications
  • Add popular social features and location-based services to your applications
  • Take advantage of Android device hardware like the camera
  • Internationalize, test, and publish your Android applications

Sample Content

Online Sample Chapter

Mastering the Android Development Tools

Sample Pages

Download the sample pages (includes Chapter 2 and Index)

Table of Contents

Introduction     1

Part I: Android Fundamentals

HOUR 1: Getting Started with Android     7

Introducing Android     7

Familiarizing Yourself with Eclipse     9

Running and Debugging Applications     17

Summary     23

Q&A     23

Workshop     24

HOUR 2: Mastering the Android Development Tools     27

Using the Android Documentation      27

Debugging Applications with DDMS     29

Working with the Android Emulator     35

Using Other Android Tools     38

Summary     39

Q&A     40

Workshop     40

HOUR 3: Building Android Applications     43

Designing a Typical Android Application     43

Using the Application Context     46

Working with Activities     47

Working with Intents     51

Working with Dialogs     53

Logging Application Information     54

Summary      55

Q&A     55

Workshop     56

HOUR 4: Managing Application Resources     59

Using Application and System Resources     59

Working with Simple Resource Values     63

Working with Drawable Resources     66

Working with Layouts     67

Working with Files     71

Working with Other Types of Resources     73

Summary     73

Q&A     74

Workshop     75

HOUR 5: Configuring the Android Manifest File     77

Exploring the Android Manifest File     77

Configuring Basic Application Settings     81

Defining Activities     86

Managing Application Permissions     88

Managing Other Application Settings     91

Summary     91

Q&A     92

Workshop     93

HOUR 6: Designing an Application Framework     95

Designing an Android Trivia Game     95

Implementing an Application Prototype     102

Running the Game Prototype     107

Summary     109

Q&A     110

Workshop      110

Part II: Building an Application Framework

HOUR 7: Implementing an Animated Splash Screen     113

Designing the Splash Screen     113

Implementing the Splash Screen Layout     114

Working with Animation     119

Summary     123

Q&A     124

Workshop     124

HOUR 8: Implementing the Main Menu Screen     127

Designing the Main Menu Screen     127

Implementing the Main Menu Screen Layout     131

Working with the ListView Control     134

Working with Other Menu Types     138

Summary     141

Q&A     141

Workshop     141

HOUR 9: Developing the Help and Scores Screens     143

Designing the Help Screen     144

Implementing the Help Screen Layout     145

Working with Files     147

Designing the Scores Screen      149

Implementing the Scores Screen Layout     151

Designing a Screen with Tabs     154

Working with XML     156

Summary     158

Q&A     158

Workshop     159

HOUR 10: Building Forms to Collect User Input     161

Designing the Settings Screen     161

Implementing the Settings Screen Layout     165

Using Common Form Controls     167

Saving Form Data with SharedPreferences     175

Summary     178

Q&A     178

Workshop     179

HOUR 11: Using Dialogs to Collect User Input     181

Working with Activity Dialogs     181

Using DatePickerDialog     184

Working with Custom Dialogs     187

Summary     194

Q&A     194

Workshop     194

HOUR 12: Adding Application Logic     197

Designing the Game Screen     197

Implementing the Game Screen Layout     200

Working with ViewSwitcher Controls     203

Wiring Up Game Logic     208

Summary     214

Q&A     215

Workshop     215

Part III: Enhancing Your Application with Powerful Android Features

HOUR 13: Working with Images and the Camera     217

Designing the Avatar Feature     217

Adding an Avatar to the Settings Screen Layout     219

Working with ImageButton Controls     221

Working with Image Media     223

Working with Bitmaps     228

Summary     230

Q&A     230

Workshop     231

HOUR 14: Adding Support for Location-Based Services     233

Designing the Favorite Place Feature     233

Implementing the Framework for the Favorite Place Feature     237

Using Location-Based Services     240

Using Geocoding Services     246

Working with Maps     248

Summary     251

Q&A     251

Workshop     252

HOUR 15: Adding Network Support     255

Designing Network Applications     255

Developing Network Applications     257

Accessing Network Services     260

Indicating Network Activity with Progress Bars     262

Running Tasks Asynchronously     265

Downloading and Displaying Scores     267

Downloading and Parsing Question Batches     271

Summary     274

Q&A     274

Workshop     274

HOUR 16: Adding More Network Support     277

Determining Data to Send to the Server     277

Accessing Phone Status Information     278

Uploading Data to a Remote Application Server     281

Summary     289

Q&A     289

Workshop     289

HOUR 17: Adding Social Features     291

Enhancing Your Application with Social Features     291

Adding Friend Support to Your Application     292

Integrating with Social Networking Services     300

Summary     302

Q&A     302

Workshop     303

HOUR 18: Creating a Home Screen App Widget     305

Designing an App Widget     305

Handling App Widget User Events     313

Working with Widget Background Operations     314

Summary     318

Q&A     318

Workshop     319

Part IV: Adding Polish to Your Android Application

HOUR 19: Internationalizing Your Application     321

General Internationalization Principles     321

How Android Localization Works     322

Android Internationalization Strategies     327

Using Localization Utilities     329

Summary     330

Q&A     331

Workshop     332

HOUR 20: Developing for Different Devices     333

Configuration Management for Android     333

Summary     343

Q&A     343

Workshop     344

HOUR 21: Diving Deeper into Android     347

Exploring More Core Android Features     347

Designing Advanced User Interfaces     349

Working with Multimedia     353

Working with 2D and 3D Graphics     354

Personalizing Android Devices     356

Managing and Sharing Data     358

Accessing Underlying Device Hardware     362

Summary     364

Q&A     364

Workshop     365

HOUR 22: Testing Android Applications     367

Testing Best Practices     367

Maximizing Test Coverage     371

Summary     380

Q&A     380

Workshop     381

Part V: Publishing Your Application

HOUR 23: Getting Ready to Publish     383

Understanding the Release Process     383

Preparing the Release Candidate Build     385

Testing the Application Release Candidate     386

Packaging and Signing an Application     387

Testing the Signed Application Package     390

Summary     392

Q&A     392

Workshop     393

HOUR 24: Publishing on the Android Market     395

Selling on the Android Market     395

Exploring Other Android Publishing Options     402

Summary     405

Q&A     405

Workshop     406

Part VI: Appendixes

APPENDIX A: Configuring Your Android Development Environment     409

Development Machine Prerequisites     409

Installing the Java Development Kit     410

Installing the Eclipse IDE     410

Installing the Android SDK     411

Installing and Configuring the Android Plug-in for Eclipse (ADT)      412

Upgrading the Android SDK     413

Configuring Development Hardware for Device Debugging     413

APPENDIX B: Eclipse IDE Tips and Tricks     415

Creating New Classes and Methods     415

Organizing Imports     415

Documenting Code     416

Using Auto-Complete      416

Editing Code Efficiently     416

Renaming Almost Anything     417

Formatting Code     418

Organizing Code     418

Fun with Refactoring     418

Resolving Mysterious Build Errors     420

Creating Custom Log Filters     420

Moving Tabs Around     421

Integrating Source Control     421

APPENDIX C: Supplementary Materials     423

Accessing the Publisher’s Website     423

Accessing the Authors’ Website      424

Contacting the Authors     425

Leveraging Online Android Resources     425

Index     427


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020