Home > Store

Android for Programmers: An App-Driven Approach, 2nd Edition

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

Android for Programmers: An App-Driven Approach, 2nd Edition


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


  • Copyright 2014
  • Edition: 2nd
  • Book
  • ISBN-10: 0-13-357092-4
  • ISBN-13: 978-0-13-357092-2

The professional programmer’s Deitel® guide to smartphone and tablet app development using Android 4.3 and 4.4, the Eclipse-based Android Development Tools and the new Android Studio

Billions of apps have been downloaded from Google Play™! This book gives you everything you’ll need to start developing great Android apps quickly and getting them published on Google Play™. The book uses an app-driven approach—each new technology is discussed in the context of seven fully tested Android apps, complete with syntax coloring, code highlighting, code walkthroughs and sample outputs. Apps you’ll develop include:

  • Welcome App
  • Cannon Game
  • Tip Calculator
  • Doodlz
  • Twitter® Searches
  • Address Book
  • Flag Quiz

The first-generation Android phones were released in October 2008. By October 2013, a Strategy Analytics report showed that Android had 81.3% of the global smartphone market share, compared to 13.4% for Apple, 4.1% for Microsoft and 1% for Blackberry (bit.ly/1aqIZXf). Billions of apps have been downloaded from Google Play. There are now more than one billion activated Android devices worldwide and more than 1.5 million Android devices are being activated daily (venturebeat.com/2013/09/03/android-hits-1bactivations-and-will-be-called-kitkat-in-nextversion). The opportunities for Android app developers are enormous.

This book presents leading-edge computing technologies for professional software developers. At the heart of the book is the Deitel “app-driven approach”—concepts are presented in the context of complete working Android apps, rather than using code snippets. The introduction and app test drives at the beginning of each chapter show one or more sample executions. The book’s source code is available at www.deitel.com/books/androidfp2.

The apps in this book were carefully designed to introduce you to key Android features and APIs. You’ll quickly learn everything you need to start building Android apps—beginning with a testdrive of the Doodlz app in Chapter 1, then building your first app in Chapter 2. By the time you reach Chapter 9, you’ll be ready to create your own apps for submission to Google Play and other app marketplaces. You’ll master the Google Play submission process, including uploading your apps, deciding whether to sell your apps or offer them for free, and marketing them using in-app advertising, social media, Internet public relations and more.

Practical, example-rich coverage of:

  • Android 4.3 and 4.4
  • Android Development Tools, Android Studio
  • Supporting Various Screen Sizes/Resolutions
  • Accessibility, Internationalization, Graphics
  • Activities, Fragments, Intents, Preferences
  • GUIs, Layouts, Menus, Resource Files, Lists, Adapters, Events, Touch/Gesture Processing
  • Immersive Mode, Printing Framework, PrintHelper
  • Assets (Images, Audio), View Animation
  • Threading, Collections, SQLite Database
  • Social sharing via implicit intents
  • Google Play™, App Publishing, Pricing, Monetization, Marketing, In-App Advertising, In-App Billing and more.

Visit www.deitel.com

  • Download code examples
  • For information on Deitel’s Dive Into® Series programming training courses delivered at organizations worldwide visit www.deitel.com/training or write to deitel@deitel.com
  • Join the Deitel social networking communities on Facebook® at deitel.com/DeitelFan, Twitter® @deitel, Google+ at google.com/+DeitelFan, LinkedIn® at bit.ly/DeitelLinkedIn, YouTube at youtube.com/user/DeitelTV and subscribe to the Deitel® Buzz Online e-mail newsletter at www.deitel.com/newsletter/subscribe.html


The Deitel® Developer Series is designed for professional programmers. The series presents focused treatments on a growing list of emerging and mature technologies, including Android™ app development, iOS® app development, Java, C# and .NET, C++, C, JavaScript®, Internet and web development and more. Each book in the series contains the same live-code teaching methodology used in the Deitels’ How to Program Series college textbooks—most concepts are presented in the context of completely coded, working apps.

Deitel & Associates is an internationally recognized authoring and corporate training organization specializing in Android and iOS® app development, programming languages, object technology and Internet and web software technology. The company offers instructor-led courses delivered at client sites worldwide on programming languages and platforms, such as Android™ app development, iOS® app development, Java, Objective-C, C#, Visual Basic®, Visual C++®, C++, C, XML, Python, Perl®, object technology, Internet and web programming, and a growing list of additional programming and software-development courses. The founders of Deitel & Associates, Inc., are Paul Deitel and Dr. Harvey Deitel. The company’s training clients include many of the world’s largest corporations, government agencies, branches of the military and academic institutions. To learn more about Deitel & Associates, Inc., its professional books, college textbooks, e-books and LiveLessons video training, and its worldwide Dive-Into® Series instructor-led, on-site training curriculum, visit www.deitel.com/training or send an email to deitel@deitel.com. Join the Deitel social media communities on Facebook® (www.deitel.com/DeitelFan), Twitter® (@deitel), Google+ (google.com/+DeitelFan), LinkedIn® (bit.ly/DeitelLinkedIn) and YouTube (youtube.com/user/DeitelTV), and subscribe to the Deitel® Buzz Online newsletter (www.deitel.com/newsletter/subscribe.html).



Download the source code files from Android for Programmers here.


Author's Site

Please visit the author's site here

Sample Content

Online Sample Chapter

Building an Android Tip Calculator App

Table of Contents

Preface xiv

Before You Begin xxiii

Chapter 1: Introduction to Android                  1

1.1 Introduction   2

1.2 Android–The World’s Leading Mobile Operating System   3

1.3 Android Features   3

1.4 Android Operating System   7

1.5 Downloading Apps from Google Play   11

1.6 Packages   12

1.7 Android Software Development Kit (SDK)   13

1.8 Object-Oriented Programming: A Quick Refresher   16

1.9 Test-Driving the Doodlz App in an Android Virtual Device (AVD)   19

1.10 Building Great Android Apps   30

1.11 Android Development Resources   32

1.12 Wrap-Up   34

Chapter 2: Welcome App          35

2.1 Introduction   36

2.2 Technologies Overview   37

2.3 Creating an App   38

2.4 Android Developer Tools Window   44

2.5 Building the App’s GUI with the Graphical Layout Editor   48

2.6 Running the Welcome App   56

2.7 Making Your App Accessible   57

2.8 Internationalizing Your App   59

2.9 Wrap-Up   63

Chapter 3: Tip Calculator App         64

3.1 Introduction   65

3.2 Test-Driving the Tip Calculator App   66

3.3 Technologies Overview   67

3.4 Building the App’s GUI   70

3.5 Adding Functionality to the App   79

3.6 AndroidManifest.xml   87

3.7 Wrap-Up   88

Chapter 4: Twitter® Searches App           89

4.1 Introduction   90

4.2 Test-Driving the App   91

4.3 Technologies Overview   97

4.4 Building the App’s GUI   100

4.5 Building the MainActivity Class   109

4.6 AndroidManifest.xml   124

4.7 Wrap-Up   124

Chapter 5: Flag Quiz App         125

5.1 Introduction   126

5.2 Test-Driving the Flag Quiz App   128

5.3 Technologies Overview   132

5.4 Building the GUI and Resource Files   136

5.5 MainActivity Class   147

5.6 QuizFragment Class   153

5.7 SettingsFragment Class   165

5.8 SettingsActivity Class   166

5.9 AndroidManifest.xml   166

5.10 Wrap-Up   167

Chapter 6: Cannon Game App           168

6.1 Introduction   169

6.2 Test-Driving the Cannon Game App   171

6.3 Technologies Overview   171

6.4 Building the App’s GUI and Resource Files   173

6.5 Class Line Maintains a Line’s Endpoints   175

6.6 MainActivity Subclass of Activity   176

6.7 CannonGameFragment Subclass of Fragment   176

6.8 CannonView Subclass of View   178

6.9 Wrap-Up   196

Chapter 7: Doodlz App        198

7.1 Introduction   199

7.2 Technologies Overview   201

7.3 Building the App’s GUI and Resource Files   203

7.4 MainActivity Class   211

7.5 DoodleFragment Class   212

7.6 DoodleView Class   219

7.7 ColorDialogFragment Class   231

7.8 LineWidthDialogFragment Class   234

7.9 EraseImageDialogFragment Class   238

7.10 Wrap-Up   239

Chapter 8: Address Book App          241

8.1 Introduction   242

8.2 Test-Driving the Address Book App  245

8.3 Technologies Overview   245

8.4 Building the GUI and Resource Files   247

8.5 MainActivity Class   255

8.6 ContactListFragment Class   261

8.7 AddEditFragment Class   268

8.8 DetailsFragment Class   274

8.9 DatabaseConnector Utility Class   282

8.10 Wrap-Up   287

Chapter 9: Google Play and App Business Issues          289

9.1 Introduction   290

9.2 Preparing Your Apps for Publication   290

9.3 Pricing Your App: Free or Fee   295

9.4 Monetizing Apps with In-App Advertising   297

9.5 Monetizing Apps: Using In-App Billing to Sell Virtual Goods   298

9.6 Registering at Google Play   299

9.7 Setting Up a Google Wallet Merchant Account   300

9.8 Uploading Your Apps to Google Play   301

9.9 Launching the Play Store from Within Your App   302

9.10 Managing Your Apps in Google Play   303

9.11 Other Android App Marketplaces   303

9.12 Other Popular Mobile App Platforms   303

9.13 Marketing Your Apps   304

9.14 Wrap-Up   308

Index         310

More Information

Unlimited one-month access with your purchase
Free Safari Membership