About the Book
Use the Book in Your Combined Java and Android App-Development Course
- A 330-page Optional Introduction to Object-Oriented Programming in Java. An extensive, yet optional, introduction to programming uses the Java language to make this book appropriate for Java courses. The appendixes provide a condensed, friendly introduction to Java and the object-oriented programming techniques needed to develop Android apps. The appendixes can be used with Java SE 6 or Java SE 7. Studying objects and classes early helps novice readers master these concepts more thoroughly, before attempting the object-oriented Android material.
- GUI Presentation. Appendix I introduces Java GUI development. Android provides its own GUI components, so this appendix presents a few Java GUI components and focuses on nested classes and anonymous inner classes, which are used extensively for event-handling in Android GUIs.
- Java Exception Handling. The Deitels integrate basic exception handling early in the Java content, and then present a richer treatment in Appendix H. They use exception handling throughout the Android chapters.
- Classes Arrays and ArrayList; Collections. Appendix E covers class Arrays with methods for performing common array manipulations, as well as generic class ArrayList which implements a dynamically resizable array-like data structure. Appendix J introduces Java’s generic collections that are used frequently in the Android treatment.
- Java Multithreading. Maintaining app responsiveness is the key to building robust Android apps, and requires extensive use of Android multithreading. Appendix J introduces multithreading fundamentals, making the authors’ use of the Android AsyncTask class in Chapter 7 more understandable.
Motivate Students with an App-driven Approach
- UPDATED! The Deitels’ App-Driven Approach. Concepts are presented in the context of eight complete working Android 6 apps. Each app chapter begins with an introduction to the app, an app test-drive showing one or more sample executions, and a technologies overview. Next, the GUI and resource files are built, followed by a detailed code walkthrough to discuss the programming concepts and Android APIs used in the app.
- NEW! Android 6 SDK. This new edition covers various new Android 6 Software Development Kit (SDK) features.
- NEW! Android Studio IDE.The free Android Studio (based on IntelliJ IDEA Community Edition) is now Google’s preferred IDE for Android app development. (The original Android development tools were based on the Eclipse IDE). Android Studio – combined with the free Android Software Development Kit (SDK) and the free Java Development Kit (JDK) – provide all the software needed to create, run, and debug Android apps; export them for distribution (e.g., upload them to Google Play™); and more. See the Before You Begin section after the Preface for download and installation instructions for all this software.
- NEW! Android 6.0 Permissions. Android 6.0 has a new permissions model that’s designed for a better user experience. Before Android 6.0, a user was required at installation time to grant in advance all permissions that an app would ever need, which often discouraged users from installing apps. With the new model, the app is installed without asking for any permissions. Instead, the user is asked to grant a permission only the first time the corresponding feature is used. Chapter 5 introduces the new permissions model and uses it to request permission from the user to store an image on the device’s external storage.
NEW! Material Design. This book focuses on the following aspects:
- Using Android’s built-in Material themes – these give Android’s built-in user-interface components a look and feel, consistent with material design principles.
- Using built-in Android Studio app templates – these are designed by Google to adhere to material design principles.
- Using user-interface components, as appropriate, that are recommended by the material design guidelines for specific purposes – these include FloatingActionButtons, TextInputLayouts, and RecyclerViews.
- NEW! Support and App Compatibility Libraries. A big challenge developers face when using new Android features is backward compatibility with earlier Android platforms. Many new Android features are now introduced via support libraries. These enable students to use new features in apps, targeting current and past Android platforms. One such library is the AppCompat library. Android Studio’s app templates have been updated to use the AppCompat library and its themes, enabling the newly created apps to run on most Android devices. Creating apps with the AppCompat library from the start, avoids having to reimplement the code when deciding to support older Android versions to target a wider audience.In addition, at the 2015 Google I/O developer conference, Google introduced the Android Design Support Library http://android-developers.blogspot.com/2015/05/android-designsupport-library.html for using material design in Android 2.1 and higher. Material design support also is built into most of Android Studio’s app templates.
- NEW! View-Holder Pattern, ListView and RecyclerView. The apps in Chapters 7—9 each display scrollable lists of data. Chapter 7 presents the data in a ListView and introduces the view-holder pattern, which improves scrolling performance by reusing GUI components that scroll off-screen. With ListViews, using the view-holder pattern is recommended. Chapters 8 and 9 each present a list of data in the more flexible and more efficient RecyclerView for which the view-holder pattern is required.
- Fragments. Starting with Chapter 4, fragments are used to create and manage portions of each app’s GUI. Several fragments can be combined to create user interfaces that take advantage of tablet screen sizes. Also, fragments can easily be interchanged to make the GUIs more dynamic, as is explained in Chapter 9.
- Printing Framework. Class PrintHelper, from Android’s printing framework for printing from an app (Chapter 5), is demonstrated. Class PrintHelper provides a user interface for selecting a printer, has a method for determining whether a given device supports printing, and provides a method for printing a Bitmap. PrintHelper is part of the Android Support Library.
- Immersive Mode. Chapter 6’s Cannon Game app uses immersive mode to hide the system bars at the screen’s top and bottom, allowing the game to fill the screen. Users can access the system bars by swiping down from the top of the screen.
- Support for multiple screen sizes and resolutions. Throughout the app chapters, the authors demonstrate how to use Android’s mechanisms for automatically choosing resources (layouts, images, etc.) based on a device’s size and orientation.
- Testing on Android Smartphones, Tablets, and the Android Emulator. For the best app-development experience, apps should be tested on actual Android smartphones and tablets. The Android emulator can still provide a meaningful experience (see the Before You Begin section), however it’s processor-intensive and can be slow – particularly with games that have a lot of moving parts. Chapter 1 mentions some Android features that are not supported on the emulator. The book discusses how to run apps on Smartphones, Tablets, and the Android Emulator.
- Multimedia. The apps in the print book use a broad range of Android multimedia capabilities, including graphics, images, frame-by-frame animation, and audio.
- Android Best Practices. The authors adhere to accepted Android best practices, pointing them out in the detailed code walkthroughs.
Enhance Learning with Outstanding Pedagogical Features
- Syntax Shading. For readability, the authors syntax shade the code, similar to Android Studio’s use of syntax coloring.
- Code Highlighting. Key code segments are enclosed in light gray rectangles for emphasis.
- Using Fonts for Emphasis. Various font conventions – each designated to a specific topic such as key terms, on-screen IDE components, or program source code – provide clarity and offer easy reference.
- Using the > Character. The > character easily indicates a selection from a menu item. For example, the notation File > New means to select the New menu item from the File menu.
- Source Code. All of the book’s source code is available for download from:
- Chapter Objectives. Each chapter begins with a list of learning objectives.
- Figures. Numerous tables, source-code listings, and screenshots are included.
- Documentation. The Android documentation, which is referenced frequently, is available at http://developer.android.com. An overview of Android Studio is available at http://developer.android.com/tools/studio/index.html.
- Software Engineering. The authors stress program clarity and performance, and concentrate on building well-engineered, object-oriented software.
- Self-Review Exercises and Answers. Extensive self-review exercises and answers are included for self-study.
- Up-to-date Exercises. Students will develop apps using a broad array of current technologies.
- All of the Android programming exercises require the implementation of complete apps where students will: enhance the existing chapter apps; develop similar apps; use creativity to develop their own apps that use the chapter technologies; and build new apps based on open-source apps available on the Internet. The Android exercises also include short-answer fill-in and true/false questions.
- In the Java exercises, students will recall important terms and concepts; indicate what code segments do; indicate what’s wrong with a portion of code; write Java statements, methods, and classes; and write complete Java programs.
- Index. An extensive index is included for reference. The page number of the defining occurrence of each key term is highlighted in the index in bold.
- Student Companion Website. Students can access source code for the examples in the book as well as additional app-development chapters at www.pearsonhighered.com/deitel.
Instructor Resources. The Pearson Instructor Resource Center (IRC) includes:
- PowerPoint® slides containing all the code and figures in the text.
- Test Item File of short-answer questions.
- Solutions Manual with solutions to the end-of-chapter short-answer exercises for both the Java and Android content. For the Java content, solutions are provided for most of the programming exercises. The suggested Android app-development project exercises are not typical homework problems. These tend to be substantial projects – many of which could require weeks of effort, possibly with students working in teams as is common in industry.
- Copyright 2017
- Dimensions: 7" x 9-1/8"
- Pages: 848
- Edition: 3rd
- ISBN-10: 0-13-444430-2
- ISBN-13: 978-0-13-444430-7
For courses in Android Programming.
Thinking like a developer — from the start.
Created by world-renowned programming instructors Paul and Harvey Deitel, Android How to Program, Third Edition introduces the dynamic world of Android smartphone and tablet app development with the Android Software Development Kit (SDK), the Java™ programming language, and the rapidly evolving Android Studio Integrated Development Environment (IDE). Updated to Android 6 and Google’s preferred Android Studio IDE, the Third Edition presents cutting-edge mobile computing technologies. The Deitels' App-driven Approach helps readers master Android app development through eight complete, working Android apps.
Each chapter features new concepts through a single app. The authors begin with an introduction to the app, followed by an app test-drive showing sample executions and a technologies overview. Next, they present detailed steps to build the app. Finally, they provide a detailed code walkthrough of the app’s source code, discussing the programming concepts and Android APIs used in the app. The book also has an extensive introduction to programming using the Java language, making it appropriate for Java courses that want to add an app-programming flavor.
Table of Contents
Before You Begin
1. Introduction to Android
2. Welcome App
3. Tip Calculator App
4. Flag Quiz App
5. Doodlz App
6. Cannon Game App
7. WeatherViewer App
8. Twitter® Searches App
9. Address Book App
10. Google Play and App Business Issues
A. Introduction to Java Applications
B. Introduction to Classes, Objects, Methods and Strings
C. Control Statements
D. Methods: A Deeper Look
E. Arrays and ArrayLists
F. Classes and Objects: A Deeper Look
G. Object-Oriented Programming: Inheritance and Polymorphism
H. Exception Handling: A Deeper Look
I. GUI Components and Event Handling
J. Other Java Topics
K. Operator Precedence Chart
L. Primitive Types