O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Android App Development

Book Description

Android App Development is written for the Android programming course and takes a building block approach, presenting a real app from start to finish in each chapter. Each chapter is broken down into manageable topics, demonstrating a topic and then a working app.

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. Table of Contents
  6. Preface
  7. 1 Basics of Android, First App: HelloAndroid
    1. 1.1 Smartphones and Their Operating Systems
      1. 1.1.1 Smartphones
      2. 1.1.2 Android Phones
      3. 1.1.3 Apps and Google Play
    2. 1.2 Development Environment for Android Apps
    3. 1.3 Our First App: HelloAndroid
      1. 1.3.1 Skeleton App
      2. 1.3.2 GUI Preview
      3. 1.3.3 XML Files: activity_main.xml, colors.xml, styles.xml, strings.xml, dimens.xml
      4. 1.3.4 The MainActivity Class
    4. 1.4 Running the App Inside the Emulator
    5. 1.5 Debugging the App with Logcat
    6. 1.6 Using the Debugger
    7. 1.7 Testing the App on an Actual Device
    8. 1.8 The App Manifest and the Gradle Build System
      1. 1.8.1 The AndroidManifest.xml File: App Icon and Device Orientation
      2. 1.8.2 The Gradle Build System
  8. 2 Model View Controller, GUI Components, Events
    1. 2.1 Model-View-Controller Architecture
    2. 2.2 The Model
    3. 2.3 GUI Components
    4. 2.4 RelativeLayout, TextView, EditText, and Button: Tip Calculator, Version 0
    5. 2.5 GUI Components and More XML Attributes: Tip Calculator, Version 1
    6. 2.6 Styles and Themes: Tip Calculator, Version 2
    7. 2.7 Events and Simple Event Handling: Coding the Controller, Tip Calculator, Version 3
    8. 2.8 More Event Handling: Tip Calculator, Version 4
  9. 3 Coding the GUI Programmatically, Layout Managers
    1. 3.1 Model View Controller Architecture
    2. 3.2 The Model
    3. 3.3 Creating the GUI Programmatically, TicTacToe, Version 0
    4. 3.4 Event Handling: TicTacToe, Version 1
    5. 3.5 Integrating the Model to Enable Game Play: TicTacToe, Version 2
    6. 3.6 Inner Classes
    7. 3.7 Layout Parameters: TicTacToe, Version 3
    8. 3.8 Alert Dialogs: TicTacToe, Version 4
    9. 3.9 Splitting the View and the Controller: TicTacToe, Version 5
  10. 4 Multiple Activities, Passing Data between Activities, Transitions, Persistent Data
    1. 4.1 Model: The Mortgage Class
    2. 4.2 Using a TableLayout for the Front Screen GUI: Mortgage Calculator App, Version 0
    3. 4.3 Using a RelativeLayout for the Second Screen GUI
    4. 4.4 Connecting Two Activities: Mortgage Calculator App, Version 1
    5. 4.5 The Life Cycle of an Activity
    6. 4.6 Sharing Data between Activities: Mortgage Calculator App, Version 2
    7. 4.7 Transitions between Activities: Mortgage Calculator App, Version 3
    8. 4.8 Handling Persistent Data: Mortgage Calculator App, Version 4
  11. 5 Menus, SQLite
    1. 5.1 Menus and Menu Items: Candy Store App, Version 0
    2. 5.2 Icon Items, Candy Store App, Version 1
    3. 5.3 SQLite: Creating a Database, a Table, and Inserting Data: Candy Store App, Version 2
    4. 5.4 Deleting Data: Candy Store App, Version 3
    5. 5.5 Updating Data: Candy Store App, Version 4
    6. 5.6 Running the Cash Register: Candy Store App, Version 5
  12. 6 Managing the Device Orientation
    1. 6.1 The Configuration Class
    2. 6.2 Capturing a Device Rotation Event
    3. 6.3 Strategy 1: One Layout XML File per Orientation
    4. 6.4 Strategy 2: One Layout XML File for Both Orientations, Modify the Layout by Code
    5. 6.5 Strategy 3: Manage Layout and Orientation 100% by Code
  13. 7 Touches and Swipes
    1. 7.1 Detecting a Touch Event
    2. 7.2 Handling a Swipe Event: Moving a TextView
    3. 7.3 The Model
    4. 7.4 The View: Setting Up the GUI, Puzzle App, Version 0
    5. 7.5 Moving the Pieces, Puzzle App, Version 1
    6. 7.6 Solving the Puzzle, Puzzle App, Version 2
    7. 7.7 Gesture and Tap Detection and Handling
    8. 7.8 Detecting a Double Tap, Puzzle App, Version 3
    9. 7.9 Making the App Device Independent, Puzzle App, Version 4
  14. 8 Graphics, Animations, Sounds, and Gaming
    1. 8.1 Graphics
    2. 8.2 Making a Custom View, Drawing, Duck Hunting App, Version 0
    3. 8.3 The Model
    4. 8.4 Animating an Object: Flying the Duck, Duck Hunting App, Version 1
    5. 8.5 Handling Touch Events: Moving the Cannon and Shooting, Duck Hunting App, Version 2
    6. 8.6 Playing a Sound: Shooting, Collision Detection, Duck Hunting App, Version 3
  15. 9 Fragments
    1. 9.1 The Model
    2. 9.2 Fragments
    3. 9.3 Defining and Adding a Fragment to an Activity Using a Layout XML File, Hangman, App Version 0
    4. 9.4 Adding GUI Components, Styles, Strings, and Colors, Hangman, App Version 1
    5. 9.5 Defining a Fragment Using a Layout XML File and Adding the Fragment to an Activity by Code, Hangman, App Version 2
    6. 9.6 Defining and Adding a Fragment to an Activity by Code, Hangman, App Version 3
    7. 9.7 Communication between Fragments and Their Activity: Enabling Play, Hangman, App Version 4
    8. 9.8 Using an Invisible Fragment, Hangman, App Version 5
    9. 9.9 Making a Fragment Reusable, Hangman, App Version 6
    10. 9.10 Improving the GUI: Processing the Keyboard Input Directly, Hangman, App Version 7
  16. 10 Using Libraries and Their APIs: Speech Recognition and Maps
    1. 10.1 Voice Recognition
    2. 10.2 Voice Recognition Part A, App Version 0
    3. 10.3 Using the Google Maps Activity Template, App Version 1
    4. 10.4 Adding Annotations to the Map, App Version 2
    5. 10.5 The Model
    6. 10.6 Displaying a Map Based on Speech Input, App Version 3
    7. 10.7 Controlling Speech Input, App Version 4
    8. 10.8 Voice Recognition Part B, Moving the Map with Voice Once, App Version 5
    9. 10.9 Voice Recognition Part C, Moving the Map with Voice Continuously, App Version 6
  17. 11 Using the GPS and Location Services
    1. 11.1 Accessing Google Play Services, GPS App, Version 0
    2. 11.2 Using the GPS to Retrieve Our Location, GPS App, Version 1
    3. 11.3 Model for Distance and Time to Destination
    4. 11.4 Distance and Time to Destination, GPS App, Version 2
    5. 11.5 Updating Distance and Time to Destination, GPS App, Version 3
  18. 12 Using Another App within the App: Taking a Photo, Graying It, and Sending an Email
    1. 12.1 Accessing the Camera App and Taking a Picture, Photo App, Version 0
    2. 12.2 The Model: Graying the Picture, Photo App, Version 1
    3. 12.3 Defining Shades of Gray Using SeekBars, Photo App, Version 2
    4. 12.4 Improving the User Interface, Photo App, Version 3
    5. 12.5 Storing the Picture, Photo App, Version 4
    6. 12.6 Using the Email App: Sending the Grayed Picture to a Friend, Photo App, Version 5
  19. 13 XML and Content Apps
    1. 13.1 Parsing XML, DOM, and SAX Parsers, Web Content App, Version 0
    2. 13.2 Parsing XML into a List, Web Content App, Version 1
    3. 13.3 Parsing a Remote XML Document, Web Content App, Version 2
    4. 13.4 Displaying the Results in a ListView, Web Content App, Version 3
    5. 13.5 Opening a Web Browser Inside the App, Web Content App, Version 4
  20. 14 Making an Android Widget
    1. 14.1 Steps in Making a Widget, Temperature Widget, Version 0
    2. 14.2 Styling the Widget, Temperature Widget, Version 1
    3. 14.3 Updating the Data in the Widget, Temperature Widget, Version 2
    4. 14.4 Updating the Data in the Widget by Clicking on It, Temperature Widget, Version 3
    5. 14.5 Retrieving the Temperature Data from a Remote Source, Temperature Widget, Version 4
    6. 14.6 Using an Activity to Customize the Widget, Temperature Widget, Version 5
    7. 14.7 Hosting the Widget in the Lock Screen, Temperature Widget, Version 6
  21. 15 In App Advertising
    1. 15.1 The View, Stopwatch App, Version 0
    2. 15.2 The Controller: Running the Stopwatch App, Version 1
    3. 15.3 Improving the Stopwatch App, Version 2
    4. 15.4 Placing the Ad, Stopwatch App, Version 3
    5. 15.5 Placing the Ad in a Fragment, Stopwatch App, Version 4
    6. 15.6 Managing the Life Cycle of the AdView, Stopwatch App, Version 5
  22. 16 Security and Encryption
    1. 16.1 Symmetric and Asymmetric Encryption
    2. 16.2 Symmetric Encryption: The Model (AES), Encryption App, Version 0
    3. 16.3 Symmetric Encryption: Adding a View, Encryption App, Version 1
    4. 16.4 Asymmetric Encryption: Adding RSA to the Model, Encryption App, Version 2
    5. 16.5 Symmetric and Asymmetric Encryption: Modifying the View, Encryption App, Version 3
  23. APPENDIX A Retrieving the Height of the Status Bar and the Action Bar Dynamically
  24. APPENDIX B Setting the Font Size of a TextView Dynamically
  25. APPENDIX C How to Download and Install Google Play Services, Use Maps
  26. APPENDIX D The AsyncTask Class
  27. INDEX