TIENE EN SU CESTA DE LA COMPRA
en total 0,00 €
The comprehensive developer guide to the latest Android features and capabilities
Professional Android, 4th Edition shows developers how to leverage the latest features of Android to create robust and compelling mobile apps. This hands-on approach provides in-depth coverage through a series of projects, each introducing a new Android platform feature and highlighting the techniques and best practices that exploit its utmost functionality. The exercises begin simply, and gradually build into advanced Android development. Clear, concise examples show you how to quickly construct real-world mobile applications.
This book is your guide to smart, efficient, effective Android development.
Learn the best practices that get more out of Android
Understand the anatomy, lifecycle, and UI metaphor of Android apps
Design for all mobile platforms, including tablets
Utilize both the Android framework and Google Play services
TABLE OF CONTENTS
INTRODUCTION xxxi
CHAPTER 1: HELLO, ANDROID 1
Android Application Development 1
A Little Background 2
The Not-So-Distant Past 3
Living in the Future 3
The Android Ecosystem 3
Pre-installed Android Applications 4
Android SDK Features 5
What Does Android Run On? 6
Why Develop for Mobile? 6
Why Develop for Android? 7
Introducing the Development Framework 7
What Comes in the Box 8
Understanding the Android Software Stack 8
The Android Run Time 10
Android Application Architecture 11
Android Libraries 12
CHAPTER 2: GETTING STARTED 13
Getting Started Developing Android Apps 14
Developing for Android 15
What You Need to Begin 15
Creating Your First Android Application 20
Getting Started Writing Android Apps Using Kotlin 35
Using the Android Support Library Package 36
Developing for Mobile and Embedded Devices 39
Hardware-Imposed Design Considerations 39
Considering the User's Environment 43
Developing for Android 44
Android Development Tools 48
Android Studio 49
The Android Virtual Device Manager 51
The Android Emulator 51
Android Profiler 52
The Android Debug Bridge 54
APK Analyzer 54
The Lint Tool 55
Monkey, Monkey Runner, and Espresso UI Testing 55
Gradle 56
CHAPTER 3: APPLICATIONS AND ACTIVITIES AND FRAGMENTS, OH MY! 57
Applications, Activities, and Fragments 58
The Components of an Android Application 58
The Android Application Life Cycle, Priority, and Process States 59
Introducing the Android Application Class 61
A Closer Look at Android Activities 61
Creating Activities 62
Using the AppCompatActivity 63
The Activity Life Cycle 64
Responding to Memory Pressure 71
Introducing Fragments 73
Creating New Fragments 73
The Fragment Life Cycle 74
Introducing the Fragment Manager 79
Adding Fragments to Activities 79
Communicating Between Fragments and Activities 85
Fragments without User Interfaces 86
Building an Earthquake Viewer Application 87
CHAPTER 4: DEFINING THE ANDROID MANIFEST AND GRADLE BUILD FILES, AND EXTERNALIZING RESOURCES 95
The Manifest, Build Files, and Resources 96
Introducing the Android Manifest 96
Configuring the Gradle Build 101
Gradle Settings File 101
Project Gradle Build File 102
Module Gradle Build Files 102
Externalizing Resources 107
Creating Resources 108
Using Resources 119
Creating Resources for Different Languages and Hardware 122
Runtime Configuration Changes 126
CHAPTER 5: BUILDING USER INTERFACES 129
Fundamental Android Design 130
Density-Independent Design 130
Android User Interface Fundamentals 131
Assigning User Interfaces to Activities 132
Introducing Layouts 132
Defining Layouts 134
Using Layouts to Create Device-Independent User Interfaces 136
Optimizing Layouts 139
The Android Widget Toolbox 143
Working with Lists and Grids 144
Recycler View and Layout Managers 145
Introducing Adapters 146
Returning to the Earthquake Viewer Application 149
Introducing Data Binding 150
Enabling Data Binding 151
Variables in Data Binding 152
Data Binding for the Earthquake Viewer Application 153
Creating New Views 155
Modifying Existing Views 155
Creating Compound Controls 159
Creating Simple Compound Controls as a Layout 161
Creating Custom Views 162
Using Custom Controls 176
CHAPTER 6: INTENTS AND BROADCAST RECEIVERS 177
Using Intents and Broadcast Receivers 178
Using Intents to Launch Activities 178
Explicitly Starting New Activities 179
Implicit Intents and Late Runtime Binding 179
Determining If an Intent Will Resolve 180
Returning Results from Activities 181
Using Platform-Native Actions to Launch Activities 184
Creating Intent Filters to Receive Implicit Intents 186
Defining an Intent Filter 186
Using Intent Filters for Plug-Ins and Extensibility 194
Introducing Linkify 198
Native Linkify Link Types 198
Creating Custom Link Strings 199
Using the Match Filter 200
Using the Transform Filter 200
Using Intents to Broadcast Events 200
Broadcasting Events with Intents 201
Listening for Intent Broadcasts with Broadcast Receivers 202
Registering Broadcast Receivers in Code 203
Registering Broadcast Receivers in Your Application Manifest 204
Managing Manifest Receivers at Run Time 204
Monitoring Device State Changes through Broadcast Intents 205
Introducing the Local Broadcast Manager 207
Introducing Pending Intents 208
CHAPTER 7: USING INTERNET RESOURCES 211
Connecting to the Internet 211
Connecting, Downloading, and Parsing Internet Resources 212
Why Build a Native Internet App? 212
Connecting to an Internet Resource 213
Performing Network Operations on Background Threads Using View Models, Live Data, and Asynchronous Tasks 214
Parsing XML Using the XML Pull Parser 219
Connecting the Earthquake Viewer to the Internet 220
Parsing JSON Using the JSON Parser 228
Using the Download Manager 233
Downloading Files 233
Customizing Download Manager Notifications 235
Specifying a Download Location 237
Canceling and Removing Downloads 238
Querying the Download Manager 238
Best Practices for Downloading Data without Draining the Battery 241
An Introduction to Internet Services and Cloud Computing 242
CHAPTER 8: FILES, SAVING STATE, AND USER PREFERENCES 245
Saving Files, States, and Preferences 246
Saving and Restoring Activity and Fragment Instance
State Using the Lifecycle Handlers 246
Retaining Instance State with Headless Fragments and View Models 248
View Models and Live Data 248
Headless Fragments 251
Creating and Saving Shared Preferences 252
Retrieving Shared Preferences 253
Introducing On Shared Preference Change Listeners 254
Configuring Auto Backup of Application Files and Shared Preferences 254
Building a Preference UI 256
Using the Preference Support Library 256
Defining a Pref