0%

Acquire the skills necessary to develop Android apps using the Android Studio integrated development environment and the Java programming language

Key Features

  • Design complex, responsive user interface layouts
  • Use the latest Material Design components to build modern user interface designs
  • Integrate with SQLite databases and the Android Room Persistence Library

Book Description

For developers, Android 11 has a ton of new capabilities. The goal of this book is to teach the skills necessary to develop Android-based applications using the Java programming language.

This book begins with the steps necessary to set up an Android development and testing environment. An overview of Android Studio along with the architecture of Android is covered next, followed by an in-depth look at the design of Android applications and user interfaces using the Android Studio environment. You will also learn about the Android architecture components along with some advanced topics such as touch screen handling, gesture recognition, the recording and playback of audio, app links, dynamic delivery, the AndroidStudio profiler, Gradle build configuration, and submitting apps to the Google Play Developer Console.

The concepts of material design, including the use of floating action buttons, Snackbars, tabbed interfaces, card views, navigation drawers, and collapsing toolbars are a highlight of this book. This edition of the book also covers printing, transitions, and cloud-based file storage; the foldable device support is the cherry on the cake.

By the end of this course, you will be able to develop Android 11 Apps using Android Studio 4.1, Java, and Android Jetpack.

What you will learn

  • Install and configure Android Studio on Windows, macOS, and Linux
  • Detect screen touches and gestures
  • Use Java threads to write asynchronous code
  • Integrate your apps with Google cloud storage
  • Divide large apps using dynamic feature modules
  • Monitor app performances using the Android Studio Profiler tool

Who this book is for

This book is for Java developers who want to learn essential skills to work with Android Studio 4.1 to build applications. The book also covers important topics about Android architecture that are essential for anyone looking to become an Android application developer.

Assuming you already have some programming experience, are ready to download Android Studio and the Android SDK, have access to a Windows, Mac, or Linux system, and ideas for some apps to develop, you are ready to get started. Some Java programming experience is also required to understand certain concepts in this book.

Table of Contents

  1. 1. Introduction
    1. 1.1 Downloading the Code Samples
    2. 1.2 Feedback
    3. 1.3 Errata
  2. 2. Setting up an Android Studio Development Environment
    1. 2.1 System Requirements
    2. 2.2 Downloading the Android Studio Package
    3. 2.3 Installing Android Studio
    4. 2.3.1 Installation on Windows
    5. 2.3.2 Installation on macOS
    6. 2.3.3 Installation on Linux
    7. 2.4 The Android Studio Setup Wizard
    8. 2.5 Installing Additional Android SDK Packages
    9. 2.6 Making the Android SDK Tools Command-line Accessible
    10. 2.6.1 Windows 7
    11. 2.6.2 Windows 8.1
    12. 2.6.3 Windows 10
    13. 2.6.4 Linux
    14. 2.6.5 macOS
    15. 2.7 Android Studio Memory Management
    16. 2.8 Updating Android Studio and the SDK
    17. 2.9 Summary
  3. 3. Creating an Example Android App in Android Studio
    1. 3.1 About the Project
    2. 3.2 Creating a New Android Project
    3. 3.3 Creating an Activity
    4. 3.4 Defining the Project and SDK Settings
    5. 3.5 Modifying the Example Application
    6. 3.6 Modifying the User Interface
    7. 3.7 Reviewing the Layout and Resource Files
    8. 3.8 Adding Interaction
    9. 3.9 Summary
  4. 4. Creating an Android Virtual Device (AVD) in Android Studio
    1. 4.1 About Android Virtual Devices
    2. 4.2 Creating a New AVD
    3. 4.3 Starting the Emulator
    4. 4.4 Running the Application in the AVD
    5. 4.5 Running on Multiple Devices
    6. 4.6 Stopping a Running Application
    7. 4.7 Supporting Dark Theme
    8. 4.8 Running the Emulator in a Tool Window
    9. 4.9 AVD Command-line Creation
    10. 4.10 Android Virtual Device Configuration Files
    11. 4.11 Moving and Renaming an Android Virtual Device
    12. 4.12 Summary
  5. 5. Using and Configuring the Android Studio AVD Emulator
    1. 5.1 The Emulator Environment
    2. 5.2 The Emulator Toolbar Options
    3. 5.3 Working in Zoom Mode
    4. 5.4 Resizing the Emulator Window
    5. 5.5 Extended Control Options
    6. 5.5.1 Location
    7. 5.5.2 Displays
    8. 5.5.3 Cellular
    9. 5.5.4 Camera
    10. 5.5.5 Battery
    11. 5.5.6 Phone
    12. 5.5.7 Directional Pad
    13. 5.5.8 Microphone
    14. 5.5.9 Fingerprint
    15. 5.5.10 Virtual Sensors
    16. 5.5.11 Snapshots
    17. 5.5.12 Record and Playback
    18. 5.5.13 Google Play
    19. 5.5.14 Settings
    20. 5.5.15 Help
    21. 5.6 Working with Snapshots
    22. 5.7 Configuring Fingerprint Emulation
    23. 5.8 The Emulator in Tool Window Mode
    24. 5.9 Summary
  6. 6. A Tour of the Android Studio User Interface
    1. 6.1 The Welcome Screen
    2. 6.2 The Main Window
    3. 6.3 The Tool Windows
    4. 6.4 Android Studio Keyboard Shortcuts
    5. 6.5 Switcher and Recent Files Navigation
    6. 6.6 Changing the Android Studio Theme
    7. 6.7 Summary
  7. 7. Testing Android Studio Apps on a Physical Android Device
    1. 7.1 An Overview of the Android Debug Bridge (ADB)
    2. 7.2 Enabling ADB on Android based Devices
    3. 7.2.1 macOS ADB Configuration
    4. 7.2.2 Windows ADB Configuration
    5. 7.2.3 Linux adb Configuration
    6. 7.3 Testing the adb Connection
    7. 7.4 Summary
  8. 8. The Basics of the Android Studio Code Editor
    1. 8.1 The Android Studio Editor
    2. 8.2 Splitting the Editor Window
    3. 8.3 Code Completion
    4. 8.4 Statement Completion
    5. 8.5 Parameter Information
    6. 8.6 Parameter Name Hints
    7. 8.7 Code Generation
    8. 8.8 Code Folding
    9. 8.9 Quick Documentation Lookup
    10. 8.10 Code Reformatting
    11. 8.11 Finding Sample Code
    12. 8.12 Live Templates
    13. 8.13 Summary
  9. 9. An Overview of the Android Architecture
    1. 9.1 The Android Software Stack
    2. 9.2 The Linux Kernel
    3. 9.3 Android Runtime – ART
    4. 9.4 Android Libraries
    5. 9.4.1 C/C++ Libraries
    6. 9.5 Application Framework
    7. 9.6 Applications
    8. 9.7 Summary
  10. 10. The Anatomy of an Android Application
    1. 10.1 Android Activities
    2. 10.2 Android Fragments
    3. 10.3 Android Intents
    4. 10.4 Broadcast Intents
    5. 10.5 Broadcast Receivers
    6. 10.6 Android Services
    7. 10.7 Content Providers
    8. 10.8 The Application Manifest
    9. 10.9 Application Resources
    10. 10.10 Application Context
    11. 10.11 Summary
  11. 11. An Overview of Android View Binding
    1. 11.1 Find View by ID
    2. 11.2 View Bindings
    3. 11.3 Converting the AndroidSample Project
    4. 11.4 Enabling View Binding
    5. 11.5 Using View Bindings
    6. 11.6 Choosing an Option
    7. 11.7 Summary
  12. 12. Understanding Android Application and Activity Lifecycles
    1. 12.1 Android Applications and Resource Management
    2. 12.2 Android Process States
    3. 12.2.1 Foreground Process
    4. 12.2.2 Visible Process
    5. 12.2.3 Service Process
    6. 12.2.4 Background Process
    7. 12.2.5 Empty Process
    8. 12.3 Inter-Process Dependencies
    9. 12.4 The Activity Lifecycle
    10. 12.5 The Activity Stack
    11. 12.6 Activity States
    12. 12.7 Configuration Changes
    13. 12.8 Handling State Change
    14. 12.9 Summary
  13. 13. Handling Android Activity State Changes
    1. 13.1 New vs. Old Lifecycle Techniques
    2. 13.2 The Activity and Fragment Classes
    3. 13.3 Dynamic State vs. Persistent State
    4. 13.4 The Android Lifecycle Methods
    5. 13.5 Lifetimes
    6. 13.6 Foldable Devices and Multi-Resume
    7. 13.7 Disabling Configuration Change Restarts
    8. 13.8 Lifecycle Method Limitations
    9. 13.9 Summary
  14. 14. Android Activity State Changes by Example
    1. 14.1 Creating the State Change Example Project
    2. 14.2 Designing the User Interface
    3. 14.3 Overriding the Activity Lifecycle Methods
    4. 14.4 Filtering the Logcat Panel
    5. 14.5 Running the Application
    6. 14.6 Experimenting with the Activity
    7. 14.7 Summary
  15. 15. Saving and Restoring the State of an Android Activity
    1. 15.1 Saving Dynamic State
    2. 15.2 Default Saving of User Interface State
    3. 15.3 The Bundle Class
    4. 15.4 Saving the State
    5. 15.5 Restoring the State
    6. 15.6 Testing the Application
    7. 15.7 Summary
  16. 16. Understanding Android Views, View Groups and Layouts
    1. 16.1 Designing for Different Android Devices
    2. 16.2 Views and View Groups
    3. 16.3 Android Layout Managers
    4. 16.4 The View Hierarchy
    5. 16.5 Creating User Interfaces
    6. 16.6 Summary
  17. 17. A Guide to the Android Studio Layout Editor Tool
    1. 17.1 Basic vs. Empty Activity Templates
    2. 17.2 The Android Studio Layout Editor
    3. 17.3 Design Mode
    4. 17.4 The Palette
    5. 17.5 Design Mode and Layout Views
    6. 17.6 Code Mode
    7. 17.7 Split Mode
    8. 17.8 Setting Attributes
    9. 17.9 Transforms
    10. 17.10 Tools Visibility Toggles
    11. 17.11 Converting Views
    12. 17.12 Displaying Sample Data
    13. 17.13 Creating a Custom Device Definition
    14. 17.14 Changing the Current Device
    15. 17.15 Layout Validation (Multi Preview)
    16. 17.16 Summary
  18. 18. A Guide to the Android ConstraintLayout
    1. 18.1 How ConstraintLayout Works
    2. 18.1.1 Constraints
    3. 18.1.2 Margins
    4. 18.1.3 Opposing Constraints
    5. 18.1.4 Constraint Bias
    6. 18.1.5 Chains
    7. 18.1.6 Chain Styles
    8. 18.2 Baseline Alignment
    9. 18.3 Configuring Widget Dimensions
    10. 18.4 Guideline Helper
    11. 18.5 Group Helper
    12. 18.6 Barrier Helper
    13. 18.7 Flow Helper
    14. 18.8 Ratios
    15. 18.9 ConstraintLayout Advantages
    16. 18.10 ConstraintLayout Availability
    17. 18.11 Summary
  19. 19. A Guide to using ConstraintLayout in Android Studio
    1. 19.1 Design and Layout Views
    2. 19.2 Autoconnect Mode
    3. 19.3 Inference Mode
    4. 19.4 Manipulating Constraints Manually
    5. 19.5 Adding Constraints in the Inspector
    6. 19.6 Viewing Constraints in the Attributes Window
    7. 19.7 Deleting Constraints
    8. 19.8 Adjusting Constraint Bias
    9. 19.9 Understanding ConstraintLayout Margins
    10. 19.10 The Importance of Opposing Constraints and Bias
    11. 19.11 Configuring Widget Dimensions
    12. 19.12 Design Time Tools Positioning
    13. 19.13 Adding Guidelines
    14. 19.14 Adding Barriers
    15. 19.15 Adding a Group
    16. 19.16 Working with the Flow Helper
    17. 19.17 Widget Group Alignment and Distribution
    18. 19.18 Converting other Layouts to ConstraintLayout
    19. 19.19 Summary
  20. 20. Working with ConstraintLayout Chains and Ratios in Android Studio
    1. 20.1 Creating a Chain
    2. 20.2 Changing the Chain Style
    3. 20.3 Spread Inside Chain Style
    4. 20.4 Packed Chain Style
    5. 20.5 Packed Chain Style with Bias
    6. 20.6 Weighted Chain
    7. 20.7 Working with Ratios
    8. 20.8 Summary
  21. 21. An Android Studio Layout Editor ConstraintLayout Tutorial
    1. 21.1 An Android Studio Layout Editor Tool Example
    2. 21.2 Creating a New Activity
    3. 21.3 Preparing the Layout Editor Environment
    4. 21.4 Adding the Widgets to the User Interface
    5. 21.5 Adding the Constraints
    6. 21.6 Testing the Layout
    7. 21.7 Using the Layout Inspector
    8. 21.8 Summary
  22. 22. Manual XML Layout Design in Android Studio
    1. 22.1 Manually Creating an XML Layout
    2. 22.2 Manual XML vs. Visual Layout Design
    3. 22.3 Summary
  23. 23. Managing Constraints using Constraint Sets
    1. 23.1 Java Code vs. XML Layout Files
    2. 23.2 Creating Views
    3. 23.3 View Attributes
    4. 23.4 Constraint Sets
    5. 23.4.1 Establishing Connections
    6. 23.4.2 Applying Constraints to a Layout
    7. 23.4.3 Parent Constraint Connections
    8. 23.4.4 Sizing Constraints
    9. 23.4.5 Constraint Bias
    10. 23.4.6 Alignment Constraints
    11. 23.4.7 Copying and Applying Constraint Sets
    12. 23.4.8 ConstraintLayout Chains
    13. 23.4.9 Guidelines
    14. 23.4.10 Removing Constraints
    15. 23.4.11 Scaling
    16. 23.4.12 Rotation
    17. 23.5 Summary
  24. 24. An Android ConstraintSet Tutorial
    1. 24.1 Creating the Example Project in Android Studio
    2. 24.2 Adding Views to an Activity
    3. 24.3 Setting View Attributes
    4. 24.4 Creating View IDs
    5. 24.5 Configuring the Constraint Set
    6. 24.6 Adding the EditText View
    7. 24.7 Converting Density Independent Pixels (dp) to Pixels (px)
    8. 24.8 Summary
  25. 25. A Guide to using Apply Changes in Android Studio
    1. 25.1 Introducing Apply Changes
    2. 25.2 Understanding Apply Changes Options
    3. 25.3 Using Apply Changes
    4. 25.4 Configuring Apply Changes Fallback Settings
    5. 25.5 An Apply Changes Tutorial
    6. 25.6 Using Apply Code Changes
    7. 25.7 Using Apply Changes and Restart Activity
    8. 25.8 Using Run App
    9. 25.9 Summary
  26. 26. An Overview and Example of Android Event Handling
    1. 26.1 Understanding Android Events
    2. 26.2 Using the android:onClick Resource
    3. 26.3 Event Listeners and Callback Methods
    4. 26.4 An Event Handling Example
    5. 26.5 The Event Listener and Callback Method
    6. 26.6 Consuming Events
    7. 26.7 Summary
  27. 27. Android Touch and Multi-touch Event Handling
    1. 27.1 Intercepting Touch Events
    2. 27.2 The MotionEvent Object
    3. 27.3 Understanding Touch Actions
    4. 27.4 Handling Multiple Touches
    5. 27.5 An Example Multi-Touch Application
    6. 27.6 Implementing the Touch Event Listener
    7. 27.7 Running the Example Application
    8. 27.8 Summary
  28. 28. Detecting Common Gestures using the Android Gesture Detector Class
    1. 28.1 Implementing Common Gesture Detection
    2. 28.2 Creating an Example Gesture Detection Project
    3. 28.3 Creating the GestureDetectorCompat Instance
    4. 28.4 Implementing the onTouchEvent() Method
    5. 28.5 Testing the Application
    6. 28.6 Summary
  29. 29. Implementing Custom Gesture and Pinch Recognition on Android
    1. 29.1 The Android Gesture Builder Application
    2. 29.2 The GestureOverlayView Class
    3. 29.3 Detecting Gestures
    4. 29.4 Identifying Specific Gestures
    5. 29.5 Installing and Running the Gesture Builder Application
    6. 29.6 Creating a Gestures File
    7. 29.7 Creating the Example Project
    8. 29.8 Adding the Gestures File to the Project
    9. 29.9 Designing the User Interface
    10. 29.10 Loading the Gestures File
    11. 29.11 Registering the Event Listener
    12. 29.12 Implementing the onGesturePerformed Method
    13. 29.13 Testing the Application
    14. 29.14 Configuring the GestureOverlayView
    15. 29.15 Intercepting Gestures
    16. 29.16 Detecting Pinch Gestures
    17. 29.17 A Pinch Gesture Example Project
    18. 29.18 Summary
  30. 30. An Introduction to Android Fragments
    1. 30.1 What is a Fragment?
    2. 30.2 Creating a Fragment
    3. 30.3 Adding a Fragment to an Activity using the Layout XML File
    4. 30.4 Adding and Managing Fragments in Code
    5. 30.5 Handling Fragment Events
    6. 30.6 Implementing Fragment Communication
    7. 30.7 Summary
  31. 31. Using Fragments in Android Studio - An Example
    1. 31.1 About the Example Fragment Application
    2. 31.2 Creating the Example Project
    3. 31.3 Creating the First Fragment Layout
    4. 31.4 Adding the Second Fragment
    5. 31.5 Adding the Fragments to the Activity
    6. 31.6 Making the Toolbar Fragment Talk to the Activity
    7. 31.7 Making the Activity Talk to the Text Fragment
    8. 31.8 Testing the Application
    9. 31.9 Summary
  32. 32. Modern Android App Architecture with Jetpack
    1. 32.1 What is Android Jetpack?
    2. 32.2 The “Old” Architecture
    3. 32.3 Modern Android Architecture
    4. 32.4 The ViewModel Component
    5. 32.5 The LiveData Component
    6. 32.6 ViewModel Saved State
    7. 32.7 LiveData and Data Binding
    8. 32.8 Android Lifecycles
    9. 32.9 Repository Modules
    10. 32.10 Summary
  33. 33. An Android Jetpack ViewModel Tutorial
    1. 33.1 About the Project
    2. 33.2 Creating the ViewModel Example Project
    3. 33.2.1 The Main Activity
    4. 33.2.2 The Content Fragment
    5. 33.2.3 The ViewModel
    6. 33.3 Designing the Fragment Layout
    7. 33.4 Implementing the View Model
    8. 33.5 Associating the Fragment with the View Model
    9. 33.6 Modifying the Fragment
    10. 33.7 Accessing the ViewModel Data
    11. 33.8 Testing the Project
    12. 33.9 Summary
  34. 34. An Android Jetpack LiveData Tutorial
    1. 34.1 LiveData - A Recap
    2. 34.2 Adding LiveData to the ViewModel
    3. 34.3 Implementing the Observer
    4. 34.4 Summary
  35. 35. An Overview of Android Jetpack Data Binding
    1. 35.1 An Overview of Data Binding
    2. 35.2 The Key Components of Data Binding
    3. 35.2.1 The Project Build Configuration
    4. 35.2.2 The Data Binding Layout File
    5. 35.2.3 The Layout File Data Element
    6. 35.2.4 The Binding Classes
    7. 35.2.5 Data Binding Variable Configuration
    8. 35.2.6 Binding Expressions (One-Way)
    9. 35.2.7 Binding Expressions (Two-Way)
    10. 35.2.8 Event and Listener Bindings
    11. 35.3 Summary
  36. 36. An Android Jetpack Data Binding Tutorial
    1. 36.1 Removing the Redundant Code
    2. 36.2 Enabling Data Binding
    3. 36.3 Adding the Layout Element
    4. 36.4 Adding the Data Element to Layout File
    5. 36.5 Working with the Binding Class
    6. 36.6 Assigning the ViewModel Instance to the Data Binding Variable
    7. 36.7 Adding Binding Expressions
    8. 36.8 Adding the Conversion Method
    9. 36.9 Adding a Listener Binding
    10. 36.10 Testing the App
    11. 36.11 Summary
  37. 37. An Android ViewModel Saved State Tutorial
    1. 37.1 Understanding ViewModel State Saving
    2. 37.2 Implementing ViewModel State Saving
    3. 37.3 Saving and Restoring State
    4. 37.4 Adding Saved State Support to the ViewModelDemo Project
    5. 37.5 Summary
  38. 38. Working with Android Lifecycle-Aware Components
    1. 38.1 Lifecycle Awareness
    2. 38.2 Lifecycle Owners
    3. 38.3 Lifecycle Observers
    4. 38.4 Lifecycle States and Events
    5. 38.5 Summary
  39. 39. An Android Jetpack Lifecycle Awareness Tutorial
    1. 39.1 Creating the Example Lifecycle Project
    2. 39.2 Creating a Lifecycle Observer
    3. 39.3 Adding the Observer
    4. 39.4 Testing the Observer
    5. 39.5 Creating a Lifecycle Owner
    6. 39.6 Testing the Custom Lifecycle Owner
    7. 39.7 Summary
  40. 40. An Overview of the Navigation Architecture Component
    1. 40.1 Understanding Navigation
    2. 40.2 Declaring a Navigation Host
    3. 40.3 The Navigation Graph
    4. 40.4 Accessing the Navigation Controller
    5. 40.5 Triggering a Navigation Action
    6. 40.6 Passing Arguments
    7. 40.7 Summary
  41. 41. An Android Jetpack Navigation Component Tutorial
    1. 41.1 Creating the NavigationDemo Project
    2. 41.2 Adding Navigation to the Build Configuration
    3. 41.3 Creating the Navigation Graph Resource File
    4. 41.4 Declaring a Navigation Host
    5. 41.5 Adding Navigation Destinations
    6. 41.6 Designing the Destination Fragment Layouts
    7. 41.7 Adding an Action to the Navigation Graph
    8. 41.8 Implement the OnFragmentInteractionListener
    9. 41.9 Triggering the Action
    10. 41.10 Passing Data Using Safeargs
    11. 41.11 Summary
  42. 42. Creating and Managing Overflow Menus on Android
    1. 42.1 The Overflow Menu
    2. 42.2 Creating an Overflow Menu
    3. 42.3 Displaying an Overflow Menu
    4. 42.4 Responding to Menu Item Selections
    5. 42.5 Creating Checkable Item Groups
    6. 42.6 Menus and the Android Studio Menu Editor
    7. 42.7 Creating the Example Project
    8. 42.8 Designing the Menu
    9. 42.9 Modifying the onOptionsItemSelected() Method
    10. 42.10 Testing the Application
    11. 42.11 Summary
  43. 43. An Introduction to MotionLayout
    1. 43.1 An Overview of MotionLayout
    2. 43.2 MotionLayout
    3. 43.3 MotionScene
    4. 43.4 Configuring ConstraintSets
    5. 43.5 Custom Attributes
    6. 43.6 Triggering an Animation
    7. 43.7 Arc Motion
    8. 43.8 Keyframes
    9. 43.8.1 Attribute Keyframes
    10. 43.8.2 Position Keyframes
    11. 43.9 Time Linearity
    12. 43.10 KeyTrigger
    13. 43.11 Cycle and Time Cycle Keyframes
    14. 43.12 Starting an Animation from Code
  44. 44. An Android MotionLayout Editor Tutorial
    1. 44.1 Creating the MotionLayoutDemo Project
    2. 44.2 ConstraintLayout to MotionLayout Conversion
    3. 44.3 Configuring Start and End Constraints
    4. 44.4 Previewing the MotionLayout Animation
    5. 44.5 Adding an OnClick Gesture
    6. 44.6 Adding an Attribute Keyframe to the Transition
    7. 44.7 Adding a CustomAttribute to a Transition
    8. 44.8 Adding Position Keyframes
    9. 44.9 Summary
  45. 45. A MotionLayout KeyCycle Tutorial
    1. 45.1 An Overview of Cycle Keyframes
    2. 45.2 Using the Cycle Editor
    3. 45.3 Creating the KeyCycleDemo Project
    4. 45.4 Configuring the Start and End Constraints
    5. 45.5 Creating the Cycles
    6. 45.6 Previewing the Animation
    7. 45.7 Adding the KeyFrameSet to the MotionScene
    8. 45.8 Summary
  46. 46. Working with the Floating Action Button and Snackbar
    1. 46.1 The Material Design
    2. 46.2 The Design Library
    3. 46.3 The Floating Action Button (FAB)
    4. 46.4 The Snackbar
    5. 46.5 Creating the Example Project
    6. 46.6 Removing Navigation Features
    7. 46.7 Changing the Floating Action Button
    8. 46.8 Adding the ListView to the Content Layout
    9. 46.9 Adding Items to the ListView
    10. 46.10 Adding an Action to the Snackbar
    11. 46.11 Summary
  47. 47. Creating a Tabbed Interface using the TabLayout Component
    1. 47.1 An Introduction to the ViewPager
    2. 47.2 An Overview of the TabLayout Component
    3. 47.3 Creating the TabLayoutDemo Project
    4. 47.4 Creating the First Fragment
    5. 47.5 Duplicating the Fragments
    6. 47.6 Adding the TabLayout and ViewPager
    7. 47.7 Creating the Pager Adapter
    8. 47.8 Performing the Initialization Tasks
    9. 47.9 Testing the Application
    10. 47.10 Customizing the TabLayout
    11. 47.11 Displaying Icon Tab Items
    12. 47.12 Summary
  48. 48. Working with the RecyclerView and CardView Widgets
    1. 48.1 An Overview of the RecyclerView
    2. 48.2 An Overview of the CardView
    3. 48.3 Summary
  49. 49. An Android RecyclerView and CardView Tutorial
    1. 49.1 Creating the CardDemo Project
    2. 49.2 Designing the CardView Layout
    3. 49.3 Adding the RecyclerView
    4. 49.4 Adding the Image Files
    5. 49.5 Creating the RecyclerView Adapter
    6. 49.6 Initializing the RecyclerView Component
    7. 49.7 Testing the Application
    8. 49.8 Responding to Card Selections
    9. 49.9 Summary
  50. 50. A Layout Editor Sample Data Tutorial
    1. 50.1 Adding Sample Data to a Project
    2. 50.2 Using Custom Sample Data
    3. 50.3 Summary
  51. 51. Working with the AppBar and Collapsing Toolbar Layouts
    1. 51.1 The Anatomy of an AppBar
    2. 51.2 The Example Project
    3. 51.3 Coordinating the RecyclerView and Toolbar
    4. 51.4 Introducing the Collapsing Toolbar Layout
    5. 51.5 Changing the Title and Scrim Color
    6. 51.6 Summary
  52. 52. An Android Studio Master/Detail Flow Tutorial
    1. 52.1 The Master/Detail Flow
    2. 52.2 Creating a Master/Detail Flow Activity
    3. 52.3 The Anatomy of the Master/Detail Flow Template
    4. 52.4 Modifying the Master/Detail Flow Template
    5. 52.5 Changing the Content Model
    6. 52.6 Changing the Detail Pane
    7. 52.7 Modifying the WebsiteDetailFragment Class
    8. 52.8 Modifying the WebsiteListActivity Class
    9. 52.9 Adding Manifest Permissions
    10. 52.10 Running the Application
    11. 52.11 Summary
  53. 53. An Overview of Android Intents
    1. 53.1 An Overview of Intents
    2. 53.2 Explicit Intents
    3. 53.3 Returning Data from an Activity
    4. 53.4 Implicit Intents
    5. 53.5 Using Intent Filters
    6. 53.6 Checking Intent Availability
    7. 53.7 Summary
  54. 54. Android Explicit Intents – A Worked Example
    1. 54.1 Creating the Explicit Intent Example Application
    2. 54.2 Creating the Second Activity Class
    3. 54.3 Designing the User Interface Layout for ActivityB
    4. 54.4 Reviewing the Application Manifest File
    5. 54.5 Creating the Intent
    6. 54.6 Extracting Intent Data
    7. 54.7 Launching ActivityB as a Sub-Activity
    8. 54.8 Returning Data from a Sub-Activity
    9. 54.9 Testing the Application
    10. 54.10 Summary
  55. 55. Android Implicit Intents – A Worked Example
    1. 55.1 Creating the Android Studio Implicit Intent Example Project
    2. 55.2 Creating the Implicit Intent
    3. 55.3 Adding a Second Matching Activity
    4. 55.4 Adding the Web View to the UI
    5. 55.5 Obtaining the Intent URL
    6. 55.6 Modifying the MyWebView Project Manifest File
    7. 55.7 Installing the MyWebView Package on a Device
    8. 55.8 Testing the Application
    9. 55.9 Summary
  56. 56. Android Broadcast Intents and Broadcast Receivers
    1. 56.1 An Overview of Broadcast Intents
    2. 56.2 An Overview of Broadcast Receivers
    3. 56.3 Obtaining Results from a Broadcast
    4. 56.4 Sticky Broadcast Intents
    5. 56.5 The Broadcast Intent Example
    6. 56.6 Creating the Example Application
    7. 56.7 Creating and Sending the Broadcast Intent
    8. 56.8 Creating the Broadcast Receiver
    9. 56.9 Registering the Broadcast Receiver
    10. 56.10 Testing the Broadcast Example
    11. 56.11 Listening for System Broadcasts
    12. 56.12 Summary
  57. 57. A Basic Overview of Threads and AsyncTasks
    1. 57.1 An Overview of Threads
    2. 57.2 The Application Main Thread
    3. 57.3 Thread Handlers
    4. 57.4 A Basic AsyncTask Example
    5. 57.5 Subclassing AsyncTask
    6. 57.6 Testing the App
    7. 57.7 Canceling a Task
    8. 57.8 Summary
  58. 58. An Overview of Android Started and Bound Services
    1. 58.1 Started Services
    2. 58.2 Intent Service
    3. 58.3 Bound Service
    4. 58.4 The Anatomy of a Service
    5. 58.5 Controlling Destroyed Service Restart Options
    6. 58.6 Declaring a Service in the Manifest File
    7. 58.7 Starting a Service Running on System Startup
    8. 58.8 Summary
  59. 59. Implementing an Android Started Service – A Worked Example
    1. 59.1 Creating the Example Project
    2. 59.2 Creating the Service Class
    3. 59.3 Adding the Service to the Manifest File
    4. 59.4 Starting the Service
    5. 59.5 Testing the IntentService Example
    6. 59.6 Using the Service Class
    7. 59.7 Creating the New Service
    8. 59.8 Modifying the User Interface
    9. 59.9 Running the Application
    10. 59.10 Creating an AsyncTask for Service Tasks
    11. 59.11 Summary
  60. 60. Android Local Bound Services – A Worked Example
    1. 60.1 Understanding Bound Services
    2. 60.2 Bound Service Interaction Options
    3. 60.3 An Android Studio Local Bound Service Example
    4. 60.4 Adding a Bound Service to the Project
    5. 60.5 Implementing the Binder
    6. 60.6 Binding the Client to the Service
    7. 60.7 Completing the Example
    8. 60.8 Testing the Application
    9. 60.9 Summary
  61. 61. Android Remote Bound Services – A Worked Example
    1. 61.1 Client to Remote Service Communication
    2. 61.2 Creating the Example Application
    3. 61.3 Designing the User Interface
    4. 61.4 Implementing the Remote Bound Service
    5. 61.5 Configuring a Remote Service in the Manifest File
    6. 61.6 Launching and Binding to the Remote Service
    7. 61.7 Sending a Message to the Remote Service
    8. 61.8 Summary
  62. 62. An Android Notifications Tutorial
    1. 62.1 An Overview of Notifications
    2. 62.2 Creating the NotifyDemo Project
    3. 62.3 Designing the User Interface
    4. 62.4 Creating the Second Activity
    5. 62.5 Creating a Notification Channel
    6. 62.6 Creating and Issuing a Basic Notification
    7. 62.7 Launching an Activity from a Notification
    8. 62.8 Adding Actions to a Notification
    9. 62.9 Bundled Notifications
    10. 62.10 Summary
  63. 63. An Android Direct Reply Notification Tutorial
    1. 63.1 Creating the DirectReply Project
    2. 63.2 Creating the Notification Channel
    3. 63.3 Building the RemoteInput Object
    4. 63.4 Creating the PendingIntent
    5. 63.5 Creating the Reply Action
    6. 63.6 Receiving Direct Reply Input
    7. 63.7 Updating the Notification
    8. 63.8 Summary
  64. 64. Foldable Devices and Multi-Window Support
    1. 64.1 Foldables and Multi-Window Support
    2. 64.2 Using a Foldable Emulator
    3. 64.3 Entering Multi-Window Mode
    4. 64.4 Enabling and using Freeform Support
    5. 64.5 Checking for Freeform Support
    6. 64.6 Enabling Multi-Window Support in an App
    7. 64.7 Specifying Multi-Window Attributes
    8. 64.8 Detecting Multi-Window Mode in an Activity
    9. 64.9 Receiving Multi-Window Notifications
    10. 64.10 Launching an Activity in Multi-Window Mode
    11. 64.11 Configuring Freeform Activity Size and Position
    12. 64.12 Summary
  65. 65. An Overview of Android SQLite Databases
    1. 65.1 Understanding Database Tables
    2. 65.2 Introducing Database Schema
    3. 65.3 Columns and Data Types
    4. 65.4 Database Rows
    5. 65.5 Introducing Primary Keys
    6. 65.6 What is SQLite?
    7. 65.7 Structured Query Language (SQL)
    8. 65.8 Trying SQLite on an Android Virtual Device (AVD)
    9. 65.9 The Android Room Persistence Library
    10. 65.10 Summary
  66. 66. The Android Room Persistence Library
    1. 66.1 Revisiting Modern App Architecture
    2. 66.2 Key Elements of Room Database Persistence
    3. 66.2.1 Repository
    4. 66.2.2 Room Database
    5. 66.2.3 Data Access Object (DAO)
    6. 66.2.4 Entities
    7. 66.2.5 SQLite Database
    8. 66.3 Understanding Entities
    9. 66.4 Data Access Objects
    10. 66.5 The Room Database
    11. 66.6 The Repository
    12. 66.7 In-Memory Databases
    13. 66.8 Database Inspector
    14. 66.9 Summary
  67. 67. An Android TableLayout and TableRow Tutorial
    1. 67.1 The TableLayout and TableRow Layout Views
    2. 67.2 Creating the Room Database Project
    3. 67.3 Converting to a LinearLayout
    4. 67.4 Adding the TableLayout to the User Interface
    5. 67.5 Configuring the TableRows
    6. 67.6 Adding the Button Bar to the Layout
    7. 67.7 Adding the RecyclerView
    8. 67.8 Adjusting the Layout Margins
    9. 67.9 Summary
  68. 68. An Android Room Database and Repository Tutorial
    1. 68.1 About the RoomDemo Project
    2. 68.2 Modifying the Build Configuration
    3. 68.3 Building the Entity
    4. 68.4 Creating the Data Access Object
    5. 68.5 Adding the Room Database
    6. 68.6 Adding the Repository
    7. 68.7 Modifying the ViewModel
    8. 68.8 Creating the Product Item Layout
    9. 68.9 Adding the RecyclerView Adapter
    10. 68.10 Preparing the Main Fragment
    11. 68.11 Adding the Button Listeners
    12. 68.12 Adding LiveData Observers
    13. 68.13 Initializing the RecyclerView
    14. 68.14 Testing the RoomDemo App
    15. 68.15 Using the Database Inspector
    16. 68.16 Summary
  69. 69. Accessing Cloud Storage using the Android Storage Access Framework
    1. 69.1 The Storage Access Framework
    2. 69.2 Working with the Storage Access Framework
    3. 69.3 Filtering Picker File Listings
    4. 69.4 Handling Intent Results
    5. 69.5 Reading the Content of a File
    6. 69.6 Writing Content to a File
    7. 69.7 Deleting a File
    8. 69.8 Gaining Persistent Access to a File
    9. 69.9 Summary
  70. 70. An Android Storage Access Framework Example
    1. 70.1 About the Storage Access Framework Example
    2. 70.2 Creating the Storage Access Framework Example
    3. 70.3 Declaring Request Codes
    4. 70.4 Creating a New Storage File
    5. 70.5 The onActivityResult() Method
    6. 70.6 Saving to a Storage File
    7. 70.7 Opening and Reading a Storage File
    8. 70.8 Testing the Storage Access Application
    9. 70.9 Summary
  71. 71. Video Playback on Android using the VideoView and MediaController Classes
    1. 71.1 Introducing the Android VideoView Class
    2. 71.2 Introducing the Android MediaController Class
    3. 71.3 Creating the Video Playback Example
    4. 71.4 Downloading the Video File
    5. 71.5 Configuring the VideoView
    6. 71.6 Adding the MediaController to the Video View
    7. 71.7 Setting up the onPreparedListener
    8. 71.8 Summary
  72. 72. Android Picture-in-Picture Mode
    1. 72.1 Picture-in-Picture Features
    2. 72.2 Enabling Picture-in-Picture Mode
    3. 72.3 Configuring Picture-in-Picture Parameters
    4. 72.4 Entering Picture-in-Picture Mode
    5. 72.5 Detecting Picture-in-Picture Mode Changes
    6. 72.6 Adding Picture-in-Picture Actions
    7. 72.7 Summary
  73. 73. An Android Picture-in-Picture Tutorial
    1. 73.1 Adding Picture-in-Picture Support to the Manifest
    2. 73.2 Adding a Picture-in-Picture Button
    3. 73.3 Entering Picture-in-Picture Mode
    4. 73.4 Detecting Picture-in-Picture Mode Changes
    5. 73.5 Adding a Broadcast Receiver
    6. 73.6 Adding the PiP Action
    7. 73.7 Testing the Picture-in-Picture Action
    8. 73.8 Summary
  74. 74. Making Runtime Permission Requests in Android
    1. 74.1 Understanding Normal and Dangerous Permissions
    2. 74.2 Creating the Permissions Example Project
    3. 74.3 Checking for a Permission
    4. 74.4 Requesting Permission at Runtime
    5. 74.5 Providing a Rationale for the Permission Request
    6. 74.6 Testing the Permissions App
    7. 74.7 Summary
  75. 75. Android Audio Recording and Playback using MediaPlayer and MediaRecorder
    1. 75.1 Playing Audio
    2. 75.2 Recording Audio and Video using the MediaRecorder Class
    3. 75.3 About the Example Project
    4. 75.4 Creating the AudioApp Project
    5. 75.5 Checking for Microphone Availability
    6. 75.6 Performing the Activity Initialization
    7. 75.7 Implementing the recordAudio() Method
    8. 75.8 Implementing the stopAudio() Method
    9. 75.9 Implementing the playAudio() method
    10. 75.10 Configuring and Requesting Permissions
    11. 75.11 Testing the Application
    12. 75.12 Summary
  76. 76. Working with the Google Maps Android API in Android Studio
    1. 76.1 The Elements of the Google Maps Android API
    2. 76.2 Creating the Google Maps Project
    3. 76.3 Obtaining Your Developer Signature
    4. 76.4 Adding the Apache HTTP Legacy Library Requirement
    5. 76.5 Testing the Application
    6. 76.6 Understanding Geocoding and Reverse Geocoding
    7. 76.7 Adding a Map to an Application
    8. 76.8 Requesting Current Location Permission
    9. 76.9 Displaying the User’s Current Location
    10. 76.10 Changing the Map Type
    11. 76.11 Displaying Map Controls to the User
    12. 76.12 Handling Map Gesture Interaction
    13. 76.12.1 Map Zooming Gestures
    14. 76.12.2 Map Scrolling/Panning Gestures
    15. 76.12.3 Map Tilt Gestures
    16. 76.12.4 Map Rotation Gestures
    17. 76.13 Creating Map Markers
    18. 76.14 Controlling the Map Camera
    19. 76.15 Summary
  77. 77. Printing with the Android Printing Framework
    1. 77.1 The Android Printing Architecture
    2. 77.2 The Print Service Plugins
    3. 77.3 Google Cloud Print
    4. 77.4 Printing to Google Drive
    5. 77.5 Save as PDF
    6. 77.6 Printing from Android Devices
    7. 77.7 Options for Building Print Support into Android Apps
    8. 77.7.1 Image Printing
    9. 77.7.2 Creating and Printing HTML Content
    10. 77.7.3 Printing a Web Page
    11. 77.7.4 Printing a Custom Document
    12. 77.8 Summary
  78. 78. An Android HTML and Web Content Printing Example
    1. 78.1 Creating the HTML Printing Example Application
    2. 78.2 Printing Dynamic HTML Content
    3. 78.3 Creating the Web Page Printing Example
    4. 78.4 Removing Navigation Features
    5. 78.5 Designing the User Interface Layout
    6. 78.6 Loading the Web Page into the WebView
    7. 78.7 Adding the Print Menu Option
    8. 78.8 Summary
  79. 79. A Guide to Android Custom Document Printing
    1. 79.1 An Overview of Android Custom Document Printing
    2. 79.1.1 Custom Print Adapters
    3. 79.2 Preparing the Custom Document Printing Project
    4. 79.3 Creating the Custom Print Adapter
    5. 79.4 Implementing the onLayout() Callback Method
    6. 79.5 Implementing the onWrite() Callback Method
    7. 79.6 Checking a Page is in Range
    8. 79.7 Drawing the Content on the Page Canvas
    9. 79.8 Starting the Print Job
    10. 79.9 Testing the Application
    11. 79.10 Summary
  80. 80. An Introduction to Android App Links
    1. 80.1 An Overview of Android App Links
    2. 80.2 App Link Intent Filters
    3. 80.3 Handling App Link Intents
    4. 80.4 Associating the App with a Website
    5. 80.5 Summary
  81. 81. An Android Studio App Links Tutorial
    1. 81.1 About the Example App
    2. 81.2 The Database Schema
    3. 81.3 Loading and Running the Project
    4. 81.4 Adding the URL Mapping
    5. 81.5 Adding the Intent Filter
    6. 81.6 Adding Intent Handling Code
    7. 81.7 Testing the App Link
    8. 81.8 Associating an App Link with a Web Site
    9. 81.9 Summary
  82. 82. A Guide to the Android Studio Profiler
    1. 82.1 Accessing the Android Profiler
    2. 82.2 Enabling Advanced Profiling
    3. 82.3 The Android Profiler Tool Window
    4. 82.4 The Sessions Panel
    5. 82.5 The CPU Profiler
    6. 82.6 Memory Profiler
    7. 82.7 Network Profiler
    8. 82.8 Energy Profiler
    9. 82.9 Summary
  83. 83. An Android Biometric Authentication Tutorial
    1. 83.1 An Overview of Biometric Authentication
    2. 83.2 Creating the Biometric Authentication Project
    3. 83.3 Configuring Device Fingerprint Authentication
    4. 83.4 Adding the Biometric Permission to the Manifest File
    5. 83.5 Designing the User Interface
    6. 83.6 Adding a Toast Convenience Method
    7. 83.7 Checking the Security Settings
    8. 83.8 Configuring the Authentication Callbacks
    9. 83.9 Adding the CancellationSignal
    10. 83.10 Starting the Biometric Prompt
    11. 83.11 Testing the Project
    12. 83.12 Summary
  84. 84. Creating, Testing and Uploading an Android App Bundle
    1. 84.1 The Release Preparation Process
    2. 84.2 Android App Bundles
    3. 84.3 Register for a Google Play Developer Console Account
    4. 84.4 Configuring the App in the Console
    5. 84.5 Enabling Google Play App Signing
    6. 84.6 Creating a Keystore File
    7. 84.7 Creating the Android App Bundle
    8. 84.8 Generating Test APK Files
    9. 84.9 Uploading the App Bundle to the Google Play Developer Console
    10. 84.10 Exploring the App Bundle
    11. 84.11 Managing Testers
    12. 84.12 Rolling the App Out for Testing
    13. 84.13 Uploading New App Bundle Revisions
    14. 84.14 Analyzing the App Bundle File
    15. 84.15 Summary
  85. 85. An Overview of Android Dynamic Feature Modules
    1. 85.1 An Overview of Dynamic Feature Modules
    2. 85.2 Dynamic Feature Module Architecture
    3. 85.3 Creating a Dynamic Feature Module
    4. 85.4 Converting an Existing Module for Dynamic Delivery
    5. 85.5 Working with Dynamic Feature Modules
    6. 85.6 Handling Large Dynamic Feature Modules
    7. 85.7 Summary
  86. 86. An Android Studio Dynamic Feature Tutorial
    1. 86.1 Creating the DynamicFeature Project
    2. 86.2 Adding Dynamic Feature Support to the Project
    3. 86.3 Designing the Base Activity User Interface
    4. 86.4 Adding the Dynamic Feature Module
    5. 86.5 Reviewing the Dynamic Feature Module
    6. 86.6 Adding the Dynamic Feature Activity
    7. 86.7 Implementing the launchIntent() Method
    8. 86.8 Uploading the App Bundle for Testing
    9. 86.9 Implementing the installFeature() Method
    10. 86.10 Adding the Update Listener
    11. 86.11 Handling Large Downloads
    12. 86.12 Using Deferred Installation
    13. 86.13 Removing a Dynamic Module
    14. 86.14 Summary
  87. 87. An Overview of Gradle in Android Studio
    1. 87.1 An Overview of Gradle
    2. 87.2 Gradle and Android Studio
    3. 87.2.1 Sensible Defaults
    4. 87.2.2 Dependencies
    5. 87.2.3 Build Variants
    6. 87.2.4 Manifest Entries
    7. 87.2.5 APK Signing
    8. 87.2.6 ProGuard Support
    9. 87.3 The Top-level Gradle Build File
    10. 87.4 Module Level Gradle Build Files
    11. 87.5 Configuring Signing Settings in the Build File
    12. 87.6 Running Gradle Tasks from the Command-line
    13. 87.7 Summary
  88. Index
52.14.8.34