Home Page Icon
Home Page
Table of Contents for
I: Platform Overview
Close
I: Platform Overview
by Shane Conder, Lauren Darcey, Joseph Annuzzi Jr.
Introduction to Android™ Application Development: Android Essentials, Fifth Edition
About This E-Book
Title Page
Copyright Page
Praise for Introduction to Android™ Application Development, Fifth Edition
Dedication Page
Contents at a Glance
Contents
Acknowledgments
About the Authors
Introduction
Who Should Read This Book
Key Questions Answered in This Book
How This Book Is Structured
An Overview of Changes in This Edition
Development Environments Used in This Book
Supplementary Materials for This Book
Conventions Used in This Book
Where to Find More Information
Contacting the Authors
I: Platform Overview
1. Presenting Android
The Android Open Source Project (AOSP)
The Open Handset Alliance
Google Goes Mobile First
Introducing the Open Handset Alliance
Joining the Open Handset Alliance
Manufacturers: Designing Android Devices
Mobile Operators: Delivering the Android Experience
Apps Drive Device Sales: Developing Android Applications
Taking Advantage of All Android Has to Offer
Android: Where We Are Now
Android Platform Uniqueness
Android: The Code Names
Free and Open Source
Familiar and Inexpensive Development Tools
Reasonable Learning Curve for Developers
Enabling Development of Powerful Applications
Rich, Secure Application Integration
No Costly Obstacles for Development
A “Free Market” for Applications
A Growing Platform
The Android Platform
Android’s Underlying Architecture
Security and Permissions
Exploring Android Applications
Android beyond the OHA and GMS
Amazon Fire OS
Cyanogen OS and CyanogenMod
Maker Movement and Open-Source Hardware
Maintaining Awareness
Summary
Quiz Questions
Exercises
References and More Information
2. Setting Up for Development
Configuring Your Development Environment
Configuring Your Operating System for Device Debugging
Configuring Your Android Hardware for Debugging
Upgrading Android Studio
Upgrading the Android SDK
Problems with Android Studio
Problems with the Android SDK
IntelliJ IDEA as an Android Studio Alternative
Exploring the Android SDK
Understanding the Android SDK License Agreement
Reading the Android SDK Documentation
Exploring the Core Android Application Framework
Exploring the Core Android Tools
Exploring the Android Sample Applications
Summary
Quiz Questions
Exercises
References and More Information
3. Creating Your First Application
Testing Your Development Environment
Importing the BorderlessButtons Sample into Android Studio
Using the Preinstalled AVD for Running Your BorderlessButtons Project
Running the BorderlessButtons Application in the Android Emulator
Building Your First Android Application
Creating and Configuring a New Android Project
Understanding the Android Symbolic View and the Traditional Project View
Core Files and Directories of the Android Application
Running Your Android Application in the Emulator
Debugging Your Android Application in the Emulator
Adding Logging Support to Your Android Application
Debugging Your Application on Hardware
Summary
Quiz Questions
Exercises
References and More Information
II: Application Basics
4. Understanding Application Components
Mastering Important Android Terminology
The Application Context
Retrieving the Application Context
Using the Application Context
Performing Application Tasks with Activities
The Lifecycle of an Android Activity
Organizing Activity Components with Fragments
Managing Activity Transitions with Intents
Transitioning between Activities with Intents
Organizing Application Navigation with Activities, Fragments, and Intents
Working with Services
Receiving and Broadcasting Intents
Summary
Quiz Questions
Exercises
References and More Information
5. Defining the Manifest
Configuring Android Applications Using the Android Manifest File
Editing the Android Manifest File
Managing Your Application’s Identity
Setting the Application Name and Icon
Enforcing Application System Requirements
Enforcing Application Platform Requirements
Other Application-Configuration Settings and Filters
Registering Activities in the Android Manifest
Designating a Primary Entry-Point Activity for Your Application Using an Intent Filter
Configuring Other Intent Filters
Registering Other Application Components
Working with Permissions
Registering Permissions Your Application Requires
Registering Permissions Your Application Enforces
Exploring Other Manifest File Settings
Summary
Quiz Questions
Exercises
References and More Information
6. Managing Application Resources
What Are Resources?
Storing Application Resources
Resource Value Types
Accessing Resources Programmatically
Adding Simple Resource Values in Android Studio
Working with Different Types of Resources
Working with String Resources
Using String Resources as Format Strings
Working with Quantity Strings
Working with String Arrays
Working with Boolean Resources
Working with Integer Resources
Working with Colors
Working with Dimensions
Using Dimension Resources Programmatically
Drawable Resources
Working with Images
Working with Color State Lists
Working with Animation
Working with Menus
Working with XML Files
Working with Raw Files
References to Resources
Working with Layouts
Designing Layouts in Android Studio
Using Layout Resources Programmatically
Referencing System Resources
Summary
Quiz Questions
Exercises
References and More Information
7. Exploring Building Blocks
Introducing Android Views and Layouts
The Android View
The Android Controls
The Android Layout
Displaying Text to Users with TextView
Configuring Layout and Sizing
Creating Contextual Links in Text
Retrieving Data from Users with Text Fields
Retrieving Text Input Using EditText Controls
Constraining User Input with Input Filters
Helping the User with Autocompletion
Giving Users Choices Using Spinner Controls
Allowing Simple User Selections with Buttons and Switches
Using Basic Buttons
Using CheckBox and ToggleButton Controls
Using RadioGroup and RadioButton
Retrieving Dates, Times, and Numbers from Users with Pickers
Using Indicators to Display Progress and Activity to Users
Indicating Progress with ProgressBar
Adding Progress Indicators to the ActionBar
Indicating Activity with Activity Bars and Activity Circles
Adjusting Progress with Seek Bars
Other Valuable User Interface Controls
Displaying Rating Data with RatingBar
Showing Time Passage with the Chronometer
Displaying the Time
Playing Video with VideoView
Summary
Quiz Questions
Exercises
References and More Information
8. Positioning with Layouts
Creating User Interfaces in Android
Creating Layouts Using XML Resources
Creating Layouts Programmatically
Organizing Your User Interface
Using ViewGroup Subclasses for Layout Design
Using ViewGroup Subclasses as View Containers
Using Built-in Layout Classes
Using LinearLayout
Using RelativeLayout
Using FrameLayout
Using TableLayout
Using GridLayout
Using Multiple Layouts on a Screen
Using Container Control Classes
Using Data-Driven Containers
Adding Scrolling Support
Exploring Other View Containers
Summary
Quiz Questions
Exercises
References and More Information
9. Partitioning with Fragments
Understanding Fragments
Understanding the Fragment Lifecycle
Managing Fragment Modifications
Working with Special Types of Fragments
Designing Fragment-Based Applications
Using the Android Support Library Package
Adding Fragment Support to Legacy Applications
Using Fragments in New Applications Targeting Older Platforms
Linking the Android Support Package to Your Project
Additional Ways to Use Fragments
Behavior Fragments without a User Interface
Exploring Nested Fragments
Summary
Quiz Questions
Exercises
References and More Information
III: Application Design Essentials
10. Architecting with Patterns
Architecting Your Application’s Navigation
Android Application Navigation Scenarios
Launching Tasks and Navigating the Back Stack
Navigating with Fragments
Relationships between Screens
Android Navigation Design Patterns
Encouraging Action
Menus
Action Bars
Floating Action Button
Actions Originating from Your Application’s Content
Dialogs
Summary
Quiz Questions
Exercises
References and More Information
11. Appealing with Style
Styling with Support
Themes and Styles
Defining the Default Application Themes
Theme and Style Inheritance
Colors
Layout
Merge and Include
TextInputLayout
FloatingActionButton
Toolbar as Bottom Bar
Application Branding
Dividers and Gaps
Menu
The Results Applied
Typography
Summary
Quiz Questions
Exercises
References and More Information
13. Designing Compatible Applications
Maximizing Application Compatibility
Designing User Interfaces for Compatibility
Working with Fragments
Leveraging the Various Android Support Library APIs
Supporting Specific Screen Types
Working with Nine-Patch Stretchable Graphics
Providing Alternative Application Resources
Understanding How Resources Are Resolved
Organizing Alternative Resources with Qualifiers
Providing Resources for Different Orientations
Using Alternative Resources Programmatically
Organizing Application Resources Efficiently
Targeting Tablets and TVs
Targeting Tablet Devices
Targeting TV Devices
Extending Your Application to Watches and Cars
Ensuring Compatibility with SafetyNet
Summary
Quiz Questions
Exercises
References and More Information
IV: Application Development Essentials
14. Using Android Preferences
Working with Application Preferences
Determining When Preferences Are Appropriate
Storing Different Types of Preference Values
Creating Private Preferences for Use by a Single Activity
Creating Shared Preferences for Use by Multiple Activities
Searching and Reading Preferences
Adding, Updating, and Deleting Preferences
Reacting to Preference Changes
Finding Preferences Data on the File System
Creating Manageable User Preferences
Creating a Preference Resource File
Using the PreferenceActivity Class
Organizing Preferences with Headers
Auto Backup for Android Applications
Summary
Quiz Questions
Exercises
References and More Information
15. Accessing Files and Directories
Working with Application Data on a Device
Practicing Good File Management
Understanding Android File Permissions
Working with Files and Directories
Exploring the Android Application Directories
Working with Other Directories and Files on the Android File System
Summary
Quiz Questions
Exercises
References and More Information
16. Saving with SQLite
SampleMaterial Upgraded with SQLite
Working with Databases
Providing Data Access
Updating the SampleMaterialActivity Class
Updating the SampleMaterialAdapter Constructor
Database Operations Off the Main UI Thread
Creating a Card in the Database
Getting All Cards
Adding a New Card
Updating a Card
Deleting a Card
Summary
Quiz Questions
Exercises
References and More Information
17. Leveraging Content Providers
Exploring Android’s Content Providers
Using the MediaStore Content Provider
Using the CallLog Content Provider
Using the CalendarContract Content Provider
Using the UserDictionary Content Provider
Using the VoicemailContract Content Provider
Using the Settings Content Provider
Introducing the ContactsContract Content Providers
Modifying Content Provider Data
Adding Records
Updating Records
Deleting Records
Using Third-Party Content Providers
Summary
Quiz Questions
Exercises
References and More Information
V: Application Delivery Essentials
18. Learning the Development Workflow
An Overview of the Android Development Process
Choosing a Software Methodology
Understanding the Dangers of Waterfall Approaches
Understanding the Value of Iteration
Gathering Application Requirements
Determining Project Requirements
Developing Use Cases for Android Applications
Incorporating Third-Party Requirements and Recommendations
Managing a Device Database
Assessing Project Risks
Identifying Target Devices
Acquiring Target Devices
Determining the Feasibility of Application Requirements
Understanding Quality Assurance Risks
Writing Essential Project Documentation
Developing Test Plans for Quality Assurance Purposes
Providing Documentation Required by Third Parties
Providing Documentation for Maintenance and Porting
Leveraging Configuration Management Systems
Choosing a Source Control System
Implementing an Application Version System That Works
Designing Android Applications
Understanding Android Device Limitations
Exploring Common Android Application Architectures
Designing for Extensibility and Maintenance
Designing for Application Interoperability
Developing Android Applications
Testing Android Applications
Controlling the Test Release
Deploying Android Applications
Determining Target Markets
Supporting and Maintaining Android Applications
Track and Address Crashes Reported by Users
Testing Firmware Upgrades
Maintaining Adequate Application Documentation
Managing Live Server Changes
Identifying Low-Risk Porting Opportunities
Application Feature Selection
Summary
Quiz Questions
Exercises
References and More Information
19. Planning the Experience
Thinking about Objectives
User Objectives
Team Objectives
Objectives of Other Stakeholders
Techniques for Focusing Your Product Efforts
Personas
User Story Mapping
Entity Discovery and Organization
Planning User Interactions
Communicating Your Application’s Identity
Designing Screen Layouts
Sketches
Wireframes
Design Comps
Reacting Properly with Visual Feedback
Observing Target Users for Usability
Mocking Up the Application
Testing the Release Build
Summary
Quiz Questions
Exercises
References and More Information
20. Delivering Quality Applications
Best Practices in Delivering Quality Applications
Meeting Android Users’ Demands
Designing User Interfaces for Android Devices
Designing Stable and Responsive Android Applications
Designing Secure Android Applications
Designing Android Applications for Maximum Profit
Following the Android Application Quality Guidelines
Leveraging Third-Party Quality Standards
Designing Android Applications for Ease of Maintenance and Upgrades
Leveraging Android Tools for Application Design
Avoiding Silly Mistakes in Android Application Design
Best Practices in Delivering Quality Android Applications
Designing a Development Process That Works for Android Development
Testing the Feasibility of Your Application Early and Often
Using Coding Standards, Reviews, and Unit Tests to Improve Code Quality
Handling Defects Occurring on a Single Device
Leveraging Android Tools for Development
Avoiding Silly Mistakes in Android Application Development
Summary
Quiz Questions
Exercises
References and More Information
21. Testing Your Applications
Best Practices in Testing Mobile Applications
Designing a Mobile Application Defect-Tracking System
Managing the Testing Environment
Maximizing Testing Coverage
Leveraging Android SDK Tools for Android Application Testing
Avoiding Silly Mistakes in Android Application Testing
Android Application Testing Essentials
Unit Testing with JUnit
Introducing the PasswordMatcher Application
Determining What Our Tests Should Prove
Creating a Run Configuration for Test Code
Writing the Tests
Running Your First Test Using Android Studio
Analyzing the Test Results
Adding Additional Tests
More Android Automated Testing Programs and APIs
Summary
Quiz Questions
Exercises
References and More Information
22. Distributing Your Applications
Choosing the Right Distribution Model
Protecting Your Intellectual Property
Following the Policies of Google Play
Billing the User
Packaging Your Application for Publication
Preparing Your Code for Packaging
Packing and Signing Your Application
Testing the Release Version of Your Application Package
Including All Required Resources
Readying Your Servers or Services
Distributing Your Application
Publishing to Google Play
Signing Up for Publishing to Google Play
Uploading Your Application to Google Play
Uploading Application Marketing Assets
Configuring Pricing and Distribution Details
Configuring Additional Application Options
Managing Other Developer Console Options
Publishing Your Application to Google Play
Managing Your Application on Google Play
Google Play Staged Rollouts
Publishing to the Google Play Private Channel
Translating Your Application
Publishing Using Other Alternatives
Self-Publishing Your Application
Summary
Quiz Questions
Exercises
References and More Information
VI: Appendixes
A. Tips and Tricks: Android Studio
Organizing Your Android Studio Workspace
Integrating with Source Control Services
Repositioning Windows within Android Studio
Resizing the Editor Window
Resizing Tool Windows
Viewing Editor Windows Side by Side
Viewing Two Sections of the Same File
Closing Unwanted Tabs
Keeping Editor Windows under Control
Creating Custom Log Filters
Searching Your Project
Organizing Android Studio Tasks
Writing Code in Java
Using Autocomplete
Creating New Classes and Methods
Organizing Imports
Reformatting Code
Renaming Almost Anything
Refactoring Code
Reorganizing Code
Using Intention Actions
Providing Javadoc-Style Documentation
Resolving Mysterious Build Errors
Summary
Quiz Questions
Exercises
References and More Information
B. Quick-Start: Android Emulator
Simulating Reality: The Emulator’s Purpose
Working with Android Virtual Devices
Using the Android Virtual Device Manager
Creating an AVD
Creating AVDs with Custom Hardware Settings
Launching the Emulator with a Specific AVD
Maintaining Emulator Performance
Launching an Emulator to Run an Application
Launching an Emulator from the Android Virtual Device Manager
Configuring the GPS Location of the Emulator
Calling between Two Emulator Instances
Messaging between Two Emulator Instances
Interacting with the Emulator through the Console
Using the Console to Simulate Incoming Calls
Using the Console to Simulate SMS Messages
Using the Console to Send GPS Coordinates
Using the Console to Monitor Network Status
Using the Console to Manipulate Power Settings
Using Other Console Commands
Personalizing the Emulator
Understanding Emulator Limitations
Summary
Quiz Questions
Exercises
References and More Information
C. Quick-Start: Android Device Monitor
Using Device Monitor with Android Studio and as a Stand-Alone Application
Getting Up to Speed Using Key Features of Device Monitor
Working with Processes, Threads, and the Heap
Attaching a Debugger to an Android Application
Stopping a Process
Monitoring Thread Activity of an Android Application
Monitoring Heap Activity
Prompting Garbage Collection
Creating and Using an HPROF File
Using the Allocation Tracker
Viewing Network Statistics
Working with the File Explorer
Browsing the File System of an Emulator or Device
Copying Files from the Emulator or Device
Copying Files to the Emulator or Device
Deleting Files on the Emulator or Device
Working with the Emulator Control
Changing Telephony Status
Simulating Incoming Voice Calls
Simulating Incoming SMS Messages
Sending a Location Fix
Working with the System Information Pane
Taking Screen Captures of the Emulator and Device Screens
Working with Application Logging
Summary
Quiz Questions
Exercises
References and More Information
D. Mastery: Android SDK Tools
Using the Android Documentation
Leveraging the Android Emulator
Viewing Application Log Data with logcat
Debugging Applications with Device Monitor
Using Android Debug Bridge (ADB)
Using the Layout Editor
Using the Android Hierarchy Viewer
Launching the Hierarchy Viewer
Working in Layout View Mode
Optimizing Your User Interface
Working in Pixel Perfect Mode
Working with Nine-Patch Stretchable Graphics
Working with Other Android Tools
Summary
Quiz Questions
Exercises
References and More Information
E. Quick-Start: Gradle Build System
Gradle Build Files
Project Settings
Module Settings
Using Android Studio to Configure Your Builds
Syncing Your Project
Configuring the Android Properties
Working with Signing Options
Configuring Different Build Flavors
Configuring Different Build Types
Configuring Application Dependencies
Adding Library Dependencies
Building Different APK Variants
Running Different Gradle Build Tasks
Summary
Quiz Questions
Exercises
References and More Information
F. Answers to Quiz Questions
Chapter 1: Presenting Android
Chapter 2: Setting Up for Development
Chapter 3: Creating Your First Application
Chapter 4: Understanding Application Components
Chapter 5: Defining the Manifest
Chapter 6: Managing Application Resources
Chapter 7: Exploring Building Blocks
Chapter 8: Positioning with Layouts
Chapter 9: Partitioning with Fragments
Chapter 10: Architecting with Patterns
Chapter 11: Appealing with Style
Chapter 12: Embracing Material Design
Chapter 13: Designing Compatible Applications
Chapter 14: Using Android Preferences
Chapter 15: Accessing Files and Directories
Chapter 16: Saving with SQLite
Chapter 17: Leveraging Content Providers
Chapter 18: Learning the Development Workflow
Chapter 19: Planning the Experience
Chapter 20: Delivering Quality Applications
Chapter 21: Testing Your Applications
Chapter 22: Distributing Your Applications
Appendix A: Tips and Tricks: Android Studio
Appendix B: Quick-Start: Android Emulator
Appendix C: Quick-Start: Android Device Monitor
Appendix D: Mastery: Android SDK Tools
Appendix E: Quick-Start: Gradle Build System
Index
Code Snippets
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Introduction
Next
Next Chapter
1. Presenting Android
I:
Platform Overview
1
Presenting Android
2
Setting Up for Development
3
Creating Your First Application
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset