Android How to Program

Book description

The Deitels' App-Driven, Live Code Approach is simply the best way to master Android programming! The Deitels teach Android programming through sixteen complete, working Android Apps. Each chapter presents new concepts through a single App. The authors first discuss what the App does, show screen shots, test drive the App, and present an overview of the technologies and architecture used to build it. Next, the authors walk through building the App, presenting complete code and providing a detailed "Live Code" walkthrough. As part of the code walkthrough, they discuss essential programming concepts, and demonstrate the functionality of relevant Android 2.x APIs. Readers will gain hands-on experience with a wide spectrum of essential Android APIs. The book also has an extensive introduction to programming using the Java language, making this book appropriate for Java courses that want to add an app-programming flavor.

Table of contents

  1. Title Page
  2. Copyright Page
  3. Deitel® Series Page
    1. How To Program Series
    2. Simply Series
    3. CourseSmart Web Books
    4. Deitel® Developer Series
    5. LiveLessons Video Learning Products
  4. Dedication
  5. Trademarks
  6. Contents
  7. Preface
    1. Android How to Program
    2. Intended Audiences
    3. App-Development Courses
    4. Android Marketplace: Competition, Innovation, Explosive Growth and Opportunities
    5. App-Driven Approach
    6. Staying in Contact with the Authors
    7. Copyright Notice and Code License
    8. Getting up to Speed in Java and XML
    9. Key Features
    10. Pedagogic Features
    11. Software Used in Android How to Program
    12. Instructor Resources
    13. Before You Begin
    14. The Deitel Online Android and Java Resource Centers
    15. CourseSmart Web Books
    16. Acknowledgments
    17. About the Authors
    18. Corporate Training from Deitel & Associates, Inc.
  8. Before You Begin
    1. Font and Naming Conventions
    2. Software and Hardware System Requirements
    3. Installing the Java Development Kit (JDK)
    4. Installing the Eclipse IDE
    5. Installing the Android SDK
    6. Installing the ADT Plugin for Eclipse
    7. Installing the Android Platform(s)
    8. Creating Android Virtual Devices (AVDs) for Use in the Android Emulator
    9. (Optional) Setting Up an Android Device for Development
    10. (Optional) Other IDEs for Developing Android Apps
    11. Obtaining the Code Examples
  9. 1. Introduction to Android
    1. 1.1. Introduction
    2. 1.2. Android Overview
    3. 1.3. Android 2.2 (Froyo)
    4. 1.4. Android 2.3 (Gingerbread)
    5. 1.5. Android 3.0 (Honeycomb)
    6. 1.6. Android 4.0 (Ice Cream Sandwich)
    7. 1.7. Downloading Apps from the Android Market
    8. 1.8. Packages
    9. 1.9. Android Software Development Kit (SDK)
    10. 1.10. Object Technology: A Quick Refresher
    11. 1.11. Test-Driving the Doodlz App in an Android Virtual Device (AVD)
    12. 1.12. Deitel Resources
    13. 1.13. Android Development Resources
    14. 1.14. Wrap-Up
    15. Self-Review Exercises
    16. Answers to Self-Review Exercises
    17. Exercises
  10. 2. Android Market and App Business Issues
    1. 2.1. Introduction
    2. 2.2. Building Great Android Apps
    3. 2.3. Android Best Practices
    4. 2.4. Registering at Android Market
    5. 2.5. Setting Up a Google Checkout Merchant Account
    6. 2.6. AndroidManifest.xml File
    7. 2.7. Preparing Your Apps for Publication
    8. 2.8. Uploading Your Apps to Android Market
    9. 2.9. Other Android App Marketplaces
    10. 2.10. Pricing Your App: Free or Fee
    11. 2.11. Monetizing Apps with In-App Advertising
    12. 2.12. Monetizing Apps: Using In-App Billing to Sell Virtual Goods in Your Apps
    13. 2.13. Launching the Market App from Within Your App
    14. 2.14. Managing Your Apps in Android Market
    15. 2.15. Marketing Your App
    16. 2.16. Other Popular App Platforms
    17. 2.17. Android Developer Documentation
    18. 2.18. Android Humor
    19. 2.19. Wrap-Up
    20. Self-Review Exercises
    21. Answers to Self-Review Exercises
    22. Exercises
  11. 3. Welcome App
    1. 3.1. Introduction
    2. 3.2. Technologies Overview
    3. 3.3. Eclipse IDE
    4. 3.4. Creating a New Project
    5. 3.5. Building the Welcome App’s GUI with the ADT’s Visual Layout Editor
    6. 3.6. Examining the main.xml File
    7. 3.7. Running the Welcome App
    8. 3.8. Wrap-Up
    9. Self-Review Exercises
    10. Answers to Self-Review Exercises
    11. Exercises
  12. 4. Tip Calculator App
    1. 4.1. Introduction
    2. 4.2. Test-Driving the Tip Calculator App
    3. 4.3. Technologies Overview
    4. 4.4. Building the App’s GUI
    5. 4.5. Adding Functionality to the App
    6. 4.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  13. 5. Favorite Twitter® Searches App
    1. 5.1. Introduction
    2. 5.2. Test-Driving the Favorite Twitter Searches App
    3. 5.3. Technologies Overview
    4. 5.4. Building the App’s GUI and Resource Files
    5. 5.5. Building the App
    6. 5.6. AndroidManifest.xml
    7. 5.7. Wrap-Up
    8. Self-Review Exercises
    9. Answers to Self-Review Exercises
    10. Exercises
  14. 6. Flag Quiz Game App
    1. 6.1. Introduction
    2. 6.2. Test-Driving the Flag Quiz Game App
    3. 6.3. Technologies Overview
    4. 6.4. Building the App’s GUI and Resource Files
    5. 6.5. Building the App
    6. 6.6. AndroidManifest.xml
    7. 6.7. Wrap-Up
    8. Self-Review Exercises
    9. Answers to Self-Review Exercises
    10. Exercises
  15. 7. Cannon Game App
    1. 7.1. Introduction
    2. 7.2. Test-Driving the Cannon Game App
    3. 7.3. Technologies Overview
    4. 7.4. Building the App’s GUI and Resource Files
    5. 7.5. Building the App
    6. 7.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  16. 8. SpotOn Game App
    1. 8.1. Introduction
    2. 8.2. Test-Driving the SpotOn Game App
    3. 8.3. Technologies Overview
    4. 8.4. Building the App’s GUI and Resource Files
    5. 8.5. Building the App
    6. 8.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  17. 9. Doodlz App
    1. 9.1. Introduction
    2. 9.2. Test-Driving the Doodlz App
    3. 9.3. Technologies Overview
    4. 9.4. Building the App’s GUI and Resource Files
    5. 9.5. Building the App
    6. 9.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  18. 10. Address Book App
    1. 10.1. Introduction
    2. 10.2. Test-Driving the Address Book App
    3. 10.3. Technologies Overview
    4. 10.4. Building the GUI and Resource Files
    5. 10.5. Building the App
    6. 10.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  19. 11. Route Tracker App
    1. 11.1. Introduction
    2. 11.2. Test-Driving the Route Tracker App
    3. 11.3. Technologies Overview
    4. 11.4. Building the GUI and Resource Files
    5. 11.5. Building the App
    6. 11.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  20. 12. Slideshow App
    1. 12.1. Introduction
    2. 12.2. Test-Driving the Slideshow App
    3. 12.3. Technologies Overview
    4. 12.4. Building the GUI and Resource Files
    5. 12.5. Building the App
    6. 12.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  21. 13. Enhanced Slideshow App
    1. 13.1. Introduction
    2. 13.2. Test-Driving the Enhanced Slideshow App
    3. 13.3. Technologies Overview
    4. 13.4. Building the GUI and Resource Files
    5. 13.5. Building the App
    6. 13.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  22. 14. Weather Viewer App
    1. 14.1. Introduction
    2. 14.2. Test-Driving the Weather Viewer App
    3. 14.3. Technologies Overview
    4. 14.4. Building the App’s GUI and Resource Files
    5. 14.5. Building the App
    6. 14.6. Wrap-Up
    7. Self-Review Exercises
    8. Answers to Self-Review Exercises
    9. Exercises
  23. A. Introduction to Java Applications
    1. A.1. Introduction
    2. A.2. Your First Program in Java: Printing a Line of Text
    3. A.3. Modifying Your First Java Program
    4. A.4. Displaying Text with printf
    5. A.5. Another Application: Adding Integers
    6. A.6. Memory Concepts
    7. A.7. Arithmetic
    8. A.8. Decision Making: Equality and Relational Operators
    9. A.9. Wrap-Up
    10. Self-Review Exercises
    11. Answers to Self-Review Exercises
    12. Exercises
  24. B. Introduction to Classes, Objects, Methods and Strings
    1. B.1. Introduction
    2. B.2. Declaring a Class with a Method and Instantiating an Object of a Class
    3. B.3. Declaring a Method with a Parameter
    4. B.4. Instance Variables, set Methods and get Methods
    5. B.5. Primitive Types vs. Reference Types
    6. B.6. Initializing Objects with Constructors
    7. B.7. Floating-Point Numbers and Type double
    8. B.8. Wrap-Up
    9. Self-Review Exercises
    10. Answers to Self-Review Exercises
    11. Exercises
  25. C. Control Statements
    1. C.1. Introduction
    2. C.2. Algorithms
    3. C.3. Pseudocode
    4. C.4. Control Structures
    5. C.5. if Single-Selection Statement
    6. C.6. if...else Double-Selection Statement
    7. C.7. while Repetition Statement
    8. C.8. Case Study: Counter-Controlled Repetition
    9. C.9. Case Study: Sentinel-Controlled Repetition
    10. C.10. Case Study: Nested Control Statements
    11. C.11. Compound Assignment Operators
    12. C.12. Increment and Decrement Operators
    13. C.13. Primitive Types
    14. C.14. Essentials of Counter-Controlled Repetition
    15. C.15. for Repetition Statement
    16. C.16. Examples Using the for Statement
    17. C.17. do...while Repetition Statement
    18. C.18. switch Multiple-Selection Statement
    19. C.19. break and continue Statements
    20. C.20. Logical Operators
    21. C.21. Wrap-Up
    22. Self-Review Exercises (Sections C.1–C.13)
    23. Self-Review Exercises (Sections C.14–C.20)
    24. Answers to Self-Review Exercises (Sections C.1–C.13)
    25. Answers to Self-Review Exercises (Sections C.14–C.20)
    26. Exercises (Sections C.1–C.13)
    27. Exercises (Sections C.14–C.20)
  26. D. Methods: A Deeper Look
    1. D.1. Introduction
    2. D.2. Program Modules in Java
    3. D.3. static Methods, static Fields and Class Math
    4. D.4. Declaring Methods with Multiple Parameters
    5. D.5. Notes on Declaring and Using Methods
    6. D.6. Method-Call Stack and Activation Records
    7. D.7. Argument Promotion and Casting
    8. D.8. Java API Packages
    9. D.9. Introduction to Random-Number Generation
    10. D.10. Case Study: A Game of Chance; Introducing Enumerations
    11. D.11. Scope of Declarations
    12. D.12. Method Overloading
    13. D.13. Wrap-Up
    14. Self-Review Exercises
    15. Answers to Self-Review Exercises
    16. Exercises
  27. E. Arrays and ArrayLists
    1. E.1. Introduction
    2. E.2. Arrays
    3. E.3. Declaring and Creating Arrays
    4. E.4. Examples Using Arrays
    5. E.5. Case Study: Card Shuffling and Dealing Simulation
    6. E.6. Enhanced for Statement
    7. E.7. Passing Arrays to Methods
    8. E.8. Case Study: Class GradeBook Using an Array to Store Grades
    9. E.9. Multidimensional Arrays
    10. E.10. Case Study: Class GradeBook Using a Two-Dimensional Array
    11. E.11. Class Arrays
    12. E.12. Introduction to Collections and Class ArrayList
    13. E.13. Wrap-Up
    14. Self-Review Exercises
    15. Answers to Self-Review Exercises
    16. Exercises
  28. F. Classes and Objects: A Deeper Look
    1. F.1. Introduction
    2. F.2. Time Class Case Study
    3. F.3. Controlling Access to Members
    4. F.4. Referring to the Current Object’s Members with the this Reference
    5. F.5. Time Class Case Study: Overloaded Constructors
    6. F.6. Default and No-Argument Constructors
    7. F.7. Composition
    8. F.8. Enumerations
    9. F.9. Garbage Collection
    10. F.10. static Class Members
    11. F.11. final Instance Variables
    12. F.12. Packages
    13. F.13. Package Access
    14. F.14. Wrap-Up
    15. Self-Review Exercise
    16. Answers to Self-Review Exercise
    17. Exercises
  29. G. Object-Oriented Programming: Inheritance and Polymorphism
    1. G.1. Introduction to Inheritance
    2. G.2. Superclasses and Subclasses
    3. G.3. protected Members
    4. G.4. Relationship between Superclasses and Subclasses
    5. G.5. Class Object
    6. G.6. Introduction to Polymorphism
    7. G.7. Polymorphism: An Example
    8. G.8. Demonstrating Polymorphic Behavior
    9. G.9. Abstract Classes and Methods
    10. G.10. Case Study: Payroll System Using Polymorphism
    11. G.11. final Methods and Classes
    12. G.12. Case Study: Creating and Using Interfaces
    13. G.13. Common Interfaces of the Java API
    14. G.14. Wrap-Up
    15. Self-Review Exercises (Sections G.1–G.5)
    16. Self-Review Exercises (Sections G.6–G.13)
    17. Answers to Self-Review Exercises (Sections G.1–G.5)
    18. Answers to Self-Review Exercises (Sections G.6–G.13)
    19. Exercises (Sections G.1–G.5)
    20. Exercises (Sections G.6–G.13)
  30. H. Exception Handling: A Deeper Look
    1. H.1. Introduction
    2. H.2. Example: Divide by Zero without Exception Handling
    3. H.3. Example: Handling ArithmeticExceptions and InputMismatchExceptions
    4. H.4. When to Use Exception Handling
    5. H.5. Java Exception Hierarchy
    6. H.6. finally Block
    7. H.7. Stack Unwinding and Obtaining Information from an Exception Object
    8. H.8. Wrap-Up
    9. Self-Review Exercises
    10. Answers to Self-Review Exercises
    11. Exercises
  31. I. GUI Components and Event Handling
    1. I.1. Introduction
    2. I.2. Nimbus Look-and-Feel
    3. I.3. Text Fields and an Introduction to Event Handling with Nested Classes
    4. I.4. Common GUI Event Types and Listener Interfaces
    5. I.5. How Event Handling Works
    6. I.6. JButton
    7. I.7. JComboBox; Using an Anonymous Inner Class for Event Handling
    8. I.8. Adapter Classes
    9. I.9. Wrap-Up
    10. Self-Review Exercises
    11. Answers to Self-Review Exercises
    12. Exercises
  32. J. Other Topics
    1. J.1. Introduction
    2. J.2. Collections Overview
    3. J.3. Type-Wrapper Classes for Primitive Types
    4. J.4. Interface Collection and Class Collections
    5. J.5. Lists
    6. J.6. Collections Methods
    7. J.7. Interface Queue
    8. J.8. Sets
    9. J.9. Maps
    10. J.10. Introduction to Files and Streams
    11. J.11. Class File
    12. J.12. Introduction to Object Serialization
    13. J.13. Introduction to Multithreading
    14. J.14. Creating and Executing Threads with the Executor Framework
    15. J.15. Overview of Thread Synchronization
    16. J.16. Concurrent Collections Overview
    17. J.17. Multithreading with GUI
    18. J.18. Wrap-Up
    19. Self-Review Exercises
    20. Answers to Self-Review Exercises
    21. Execises
  33. K. Operator Precedence Chart
  34. L. Primitive Types
  35. Index

Product information

  • Title: Android How to Program
  • Author(s): Harvey Deitel, Abbey Deitel, Paul Deitel
  • Release date: February 2012
  • Publisher(s): Pearson
  • ISBN: 9780133077698