28,99 €
Conquer the world of Android app development Android has taken over the mobile and TV markets and become unstoppable! Android offers a vast stage for developers to serve millions--and rake in the profits--with diverse and wide-ranging app ideas. Whether you're a raw recruit or a veteran programmer, you can get in on the action and become a master of the Android programming universe with the new edition of Android Application Development For Dummies All-in-One. In addition to receiving guidance on mobile and TV development, you'll find overviews of native code, watch, car, Android wear, and other device development. This friendly, easy-to-follow book kicks off by offering a fundamental understanding of Android's major technical ideas, including functional programming techniques. It moves on to show you how to work effectively in Studio, program cool new features, and test your app to make sure it's ready to release to a waiting world. You'll also have an opportunity to brush up on your Kotlin and develop your marketing savvy. There are millions of potential customers out there, and you want to stand out from the crowd! * Understand new features and enhancements * Get development best-practices * Know your Android hardware * Access online materials With a market share like Android's, the stakes couldn't be higher. Android Application Development For Dummies All-in-One levels the field and gives you the tools you need to take on the world.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 1070
Veröffentlichungsjahr: 2020
Android® Application Development All-in-One For Dummies®, 3rd Edition
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2020 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be used without written permission. Android is a registered trademark of Google, LLC. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit https://hub.wiley.com/community/support/dummies.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2020939707
ISBN: 978-1-119-66045-3
ISBN 978-1-119-66043-9 (ebk); ISBN 978-1-119-66046-0 (ebk)
Cover
Introduction
How to Use This Book
Conventions Used in This Book
Foolish Assumptions
Icons Used in This Book
Beyond the Book
Where to Go from Here
Book 1: Getting Started with Android Application Development
Chapter 1: All about Android
The Consumer Perspective
The Versions of Android
The Developer Perspective
The Business Perspective
Chapter 2: Installing the Software Tools
Setting Up the Software
Launching the Android Studio IDE
Fattening Up the Android SDK
Chapter 3: Creating an Android App
Creating Your First App
Running Your App
You Can Download All the Code
Troubleshooting Common IDE Errors
Testing Apps on a Real Device
Chapter 4: Examining a Basic Android App
A Project’s Files
The MainActivity.kt file
The res Branch
Other Files in an Android Project
What Did I Agree To?
Chapter 5: Conjuring and Embellishing an Android App
Dragging, Dropping, and Otherwise Tweaking an App
A Bit of Debugging
Chapter 6: Improving Your App
Improving the Layout
Starting Another Activity
Localizing Your App
Responding to Check Box Events
Displaying Images
Sending in Your Order
Book 2: Android Background Material
Chapter 1: Using Android Studio
Good to Know versus Need to Know
Getting a Feel for the Big Picture
Discovering What You Can Do
Chapter 2: Kotlin for Java Programmers
Using Kotlin or Java for Development
Defining the Java Issues That Kotlin Fixes
Nothing’s Perfect: Kotlin Is Missing Features, Too
Looking at What Kotlin Adds to the Picture
Chapter 3: Kotlin for Everyone
Moving from Development to Execution with Kotlin
Grasping Kotlin Code
Chapter 4: What Kotlin Does (and When)
Making Decisions (Kotlin if Statements)
Repeating Instructions Over and Over Again
Jumping Away from Trouble
Working with Kotlin Collections
Chapter 5: Object-Oriented Programming in Kotlin
Static Fields and Methods
Interfaces and Callbacks
Classes That Must (and Must Not) Be Extended
Inner Classes
Chapter 6: Functional Programming in Kotlin
Defining Functional Programming
Understanding Pure and Impure Languages
Comparing the Functional Paradigm
Using Kotlin for Functional Programming Needs
Defining the Role of State
Using Recursion to Perform Calculations
Using Function Types
Understanding Function Literals
Defining the Function Types
Using Functional Programming for Android Apps
Chapter 7: A <brief> Look at XML
XML Isn't Ordinary Text
What's in a Namespace?
Book 3: The Building Blocks
Chapter 1: Getting an Overview of Jetpack
Understanding the Benefits of Jetpack
Considering the Jetpack Components
Getting an Overview of the AndroidX Package
Working with Lifecycle-Aware Components
Chapter 2: Building a Foundation for Your App
Working with Android KTX
Addressing Security Issues
Benchmarking Your Application
Testing Application Functionality
Chapter 3: Creating an Architecture
Managing Application Activities
Providing for Navigational Needs
Performing Background Tasks Using WorkManager
Chapter 4: Defining an App’s Behavior
Working with Notifications
Getting Permission
Complying with User Preferences
Working with MediaPlayer
Adding Camera Support Using CameraX
Sharing with Others
Chapter 5: Interacting with the Users
Creating a Great Layout
Employing Color and Texture
Using Animations and Transitions
Communicating with Emoji
Book 4: Programming Cool Phone Features
Chapter 1: Hungry Burds: A Simple Android Game
Introducing the Hungry Burds Game
The Hungry Burds Project's Files
The Main Activity
The Code, All the Code, and Nothing But the Code
Setting Up the Game
Displaying a Burd
Handling a Touch Event
Finishing Up
Chapter 2: An Android Social Media App
Setting Things Up on Facebook's Developer Site
A Minimal Facebook App
Enriching the Minimal App
Chapter 3: Going Native
The Native Development Kit
Creating an Application
Book 5: Apps for Tablets, Watches, TV Sets, and Cars
Chapter 1: Apps for Tablets
Gaining Perspective
Developing a Nested Navigational Graph
Creating a Responsive App
Chapter 2: Developing for Android Wear
Seeing Where Wearables Are Used
Setting Up Your Testing Environment
Wearable Apps: What's the Big Deal?
Case Study: A Watch Face
Chapter 3: Developing for Android TV
Getting Started
Running the Skeletal App
Dissecting the TV App
Chapter 4: Developing for Android Auto
Checking Auto Compatibility
Choosing the Google Play Services
Considering Notification Limits
Creating an Emulator
Developing an Android Auto App
Book 6: The Job Isn’t Done Until …
Chapter 1: Publishing Your App to the Google Play Store
Creating a Google Play Developer Account
Preparing Your Code
Preparing Graphic Assets for the Play Store
Creating a Publishable File
Publishing Your App
Leave No Stone Unturned
Publishing Elsewhere
Chapter 2: Monetizing and Marketing Your App
Choosing a Revenue Model
Marketing Your Application
Brick Breaker Master: An App Marketing Case Study
Chapter 3: Creating Public Support for Your App
Obtaining Support through Patreon
Developing Your Own Distribution Stream
Taking the Personal Approach
Considering App Store Alternatives
Getting Awards
Index
About the Authors
Connect with Dummies
End User License Agreement
Book 2 Chapter 3
TABLE 3-1 A Table of Accounts
TABLE 3-2 Kotlin’s Numeric Data Types
TABLE 3-3 Kotlin's Other Basic Types
Book 1 Chapter 1
FIGURE 1-1: Android version history.
FIGURE 1-2: The Android system architecture.
Book 1 Chapter 2
FIGURE 2-1: Downloading Android tools for the default platform.
FIGURE 2-2: Downloading Android tools for an alternative platform.
FIGURE 2-3: The ANDROID_HOME folder.
FIGURE 2-4: The manual-offline-m2 folder.
FIGURE 2-5: The offline files used to support Android Studio.
FIGURE 2-6: The Gradle build tool configuration file location.
FIGURE 2-7: The Gradle build tool configuration file.
FIGURE 2-8: Importing existing settings.
FIGURE 2-9: Starting the SDK installation.
FIGURE 2-10: Choosing a UI theme.
FIGURE 2-11: Finally getting to the initial Android Studio opening ...
FIGURE 2-12: The Android SDK Manager.
FIGURE 2-13: The Android SDK Tools appear on a separate tab.
FIGURE 2-14: Choose a category and device that meets your needs.
FIGURE 2-15: Download the system image you want to test.
FIGURE 2-16: Download the system image you want to test.
FIGURE 2-17: The Android Virtual Device Manager shows the list of d...
Book 1 Chapter 3
FIGURE 3-1: Welcome to Android Studio.
FIGURE 3-2: Select a device and associated starting point (template)...
FIGURE 3-3: Define the app configuration.
FIGURE 3-4: Your project is ready for editing.
FIGURE 3-5: Look at the design of your new app.
FIGURE 3-6: The Build Output window tells you about the build progre...
FIGURE 3-7: The Profiler helps you track application resource usage.
FIGURE 3-8: The home screen appears while Android Studio loads the a...
FIGURE 3-9: The app screen appears after the loading process is comp...
FIGURE 3-10: Locating the
build.gradle
file for a project.
FIGURE 3-11: Syncing Android Studio to the project.
FIGURE 3-12: Choosing a device.
FIGURE 3-13: Running on multiple devices.
FIGURE 3-14: Using the Actions icons in the AVD Manager.
Book 1 Chapter 4
FIGURE 4-1: A run of the app created by Android Studio.
FIGURE 4-2: The structure of a new project in Android Studio.
FIGURE 4-3: Options for the Project tool window.
FIGURE 4-4: Themes and styles make customizing your app easy.
FIGURE 4-5: The very hidden location of the super-secret
R.java
file...
FIGURE 4-6: The
R.java
file contains some interesting entries.
FIGURE 4-7: Some of the packages and classes in
android.jar
.
FIGURE 4-8: The
android.jar
file includes general-purpose Java packa...
FIGURE 4-9: The debug APK file for MyFirstApp.
FIGURE 4-10: A nicely formatted view of
output.json
.
Book 1 Chapter 5
FIGURE 5-1: Design mode allows for drag-and-drop design.
FIGURE 5-2: You want to create this app.
FIGURE 5-3: Each component must have constraints assigned to it.
FIGURE 5-4: Changing the properties of a check box.
FIGURE 5-5: Constraints position the component onscreen.
FIGURE 5-6: The text field has a generic value associated with it.
FIGURE 5-7: Obtain access to the currently defined resources.
FIGURE 5-8: Create a new string resource.
FIGURE 5-9: Defining a connection between your form and the code.
FIGURE 5-10: Running this section's app.
FIGURE 5-11: A layout containing a new text component.
FIGURE 5-12: The Run window.
FIGURE 5-13: The Logcat window.
FIGURE 5-14: The Create New Logcat Filter dialog box.
FIGURE 5-15: A breakpoint.
FIGURE 5-16: The Debug tool window.
FIGURE 5-17: The variable
i
appears.
FIGURE 5-18: The debugger supplies the value of
i
.
FIGURE 5-19: The variable
temp
appears.
Book 1 Chapter 6
FIGURE 6-1: Your mission, should you decide to accept it.
FIGURE 6-2: This app uses a
LinearLayout
for component layout, rathe...
FIGURE 6-3: Place the various components at the correct levels to ob...
FIGURE 6-4: The Component Tree (what you have so far, anyway).
FIGURE 6-5: A list of refactoring options.
FIGURE 6-6: Extracting your style for future use.
FIGURE 6-7: The saved layout Component Tree.
FIGURE 6-8: Place a copy of a layout or other file in your current p...
FIGURE 6-9: The Resources dialog box.
FIGURE 6-10: The Configure Activity dialog box.
FIGURE 6-11: A new activity appears on the device's screen.
FIGURE 6-12: The Translations Editor.
FIGURE 6-13: Select a language.
FIGURE 6-14: Look! You have two
strings.xml
files.
FIGURE 6-15: Add the required language support to your emulator.
FIGURE 6-16:
Buongiorno!
FIGURE 6-17: A reduced number of control versions of the previous e...
FIGURE 6-18: Be sure to choose the correct destination for the file...
FIGURE 6-19: Use the Resources dialog box to configure the
ImageVie
...
FIGURE 6-20: What a lovely drawing!
FIGURE 6-21: Your app sends stuff to a web server.
Book 2 Chapter 1
FIGURE 1-1: A project with two modules.
FIGURE 1-2: The Welcome screen.
FIGURE 1-3: The main window has several areas.
FIGURE 1-4: Selecting the Project view.
FIGURE 1-5: The Packages view.
FIGURE 1-6: Look! No Project tool window!
FIGURE 1-7: The Structure tool window.
FIGURE 1-8: The Terminal tool window on a PC.
FIGURE 1-9: The Run tool window.
FIGURE 1-10: The icon for hiding areas.
FIGURE 1-11: Selecting viewing modes.
FIGURE 1-12: Seeing the Project window undocked.
FIGURE 1-13: Use the float mode to move windows somewhere outside t...
FIGURE 1-14: Window mode is similar to float mode, except you see a...
FIGURE 1-15: The Designer tool's Design mode.
FIGURE 1-16: The Designer tool's Text mode.
FIGURE 1-17: Locate the components or attributes you want to work w...
FIGURE 1-18: Finding a Find option.
FIGURE 1-19: The Find panel.
FIGURE 1-20: The Find in Path dialog box.
FIGURE 1-21: The editor highlights occurrences of the selected vari...
FIGURE 1-22: A list of intention actions.
FIGURE 1-23: Configuring the parameter name hints.
FIGURE 1-24: Defining the appearance of code onscreen.
FIGURE 1-25: Android Studio displays the Log class's static members...
FIGURE 1-26: Android Studio suggests the variables to type.
FIGURE 1-27: The IDE automatically provides the type.
FIGURE 1-28: Cannot resolve reference.
FIGURE 1-29: Do you mean
android.widget.Toast
?
FIGURE 1-30: You don't see just one potential fix for the
Toast
iss...
FIGURE 1-31: Several options for generating code.
FIGURE 1-32: Choose fields to initialize.
FIGURE 1-33: The Extract Function dialog box.
FIGURE 1-34: Renaming a method.
Book 2 Chapter 2
FIGURE 2-1: You can still choose to develop in Java.
Book 2 Chapter 3
FIGURE 3-1: The contents of an executable file look like nothing mor...
FIGURE 3-2: The bytecode created for MainActivity.kt.
FIGURE 3-3: The translation process for an Android app.
FIGURE 3-4: Seeing the content of the
.apk
file.
FIGURE 3-5: Classes in the
classes.dex
file.
FIGURE 3-6: Viewing the DEX bytecode.
FIGURE 3-7: Seeing the list of compiled resources for your app.
FIGURE 3-8: Viewing the source for a parent class in Android Studio.
Book 2 Chapter 5
FIGURE 5-1: The interface hierarchy cuts across the class hierarchy.
FIGURE 5-2: Handling an event.
FIGURE 5-3: How a listener remembers its creator.
Book 2 Chapter 7
FIGURE 7-1: Be a good son or daughter.
Book 3 Chapter 1
FIGURE 1-1: Using a graphical editor to create a navigation graph.
FIGURE 1-2: Checking memory usage in your app.
Book 3 Chapter 2
FIGURE 2-1: Creating a simple app for profiling, tracing, and benchm...
FIGURE 2-2: Android Studio provides a visualization of your app's us...
FIGURE 2-3: View the use of various resource categories.
FIGURE 2-4: Choose the specific element of your app that you want to...
FIGURE 2-5: The results of creating a trace log for the example app.
FIGURE 2-6: Looking at a trace log in detail.
FIGURE 2-7: Creating the custom properties file.
FIGURE 2-8: Creating a new module.
FIGURE 2-9: Define the module name and package.
FIGURE 2-10: Locating the benchmark.
FIGURE 2-11: Seeing the test result.
Book 3 Chapter 3
FIGURE 3-1: A view of the backstack with activities.
FIGURE 3-2: A backstack with multiple invocations of Activity 1.
FIGURE 3-3: An activity that contains two fragments.
FIGURE 3-4: Configure a new activity.
FIGURE 3-5: Create user interfaces for the three activities.
FIGURE 3-6: Configure a new fragment.
FIGURE 3-7: Configure
MainActivity
to hold the fragment.
FIGURE 3-8: Display an alert dialog box onscreen.
FIGURE 3-9: Create a dialog box fragment class.
FIGURE 3-10: Design a layout for the dialog box fragment class.
FIGURE 3-11: Displaying a custom dialog box fragment with interesti...
FIGURE 3-12: Sync the IDE to your Gradle files before creating the ...
FIGURE 3-13: Create the navigation graph resource.
FIGURE 3-14: An empty navigation graph.
FIGURE 3-15: Associating an activity with a navigation graph.
FIGURE 3-16: Navigation graph controls.
FIGURE 3-17: Choose a destination type for the navigation graph.
FIGURE 3-18: Define the new destination fragment.
FIGURE 3-19: Seeing the fragment added to the navigation graph.
FIGURE 3-20: Arrange the destinations in a way that makes using the...
FIGURE 3-21: Create actions between each of the destinations.
FIGURE 3-22: Writing a file requires user permissions.
Book 3 Chapter 4
FIGURE 4-1: An icon with a transparent background.
FIGURE 4-2: Seeing the notification on the status bar.
FIGURE 4-3: The notification as it appears in the notification drawe...
FIGURE 4-4: Notification reception preferences are automatic.
FIGURE 4-5: A user can revoke permissions after the fact.
FIGURE 4-6: Create a new preference resource file.
FIGURE 4-7: Each preference appears in a <Preference> element.
FIGURE 4-8: The Settings option that appears after clicking the elli...
FIGURE 4-9: Display the preference menu onscreen.
FIGURE 4-10: Changing the user name.
FIGURE 4-11: Creating a directory to hold the music source.
Book 3 Chapter 5
FIGURE 5-1: Defining a <merge> element as the root element.
FIGURE 5-2: Selecting the
<merge>
to provide in the
<include
...
FIGURE 5-3: Viewing the scrollable list.
FIGURE 5-4: Select the process you want to inspect.
FIGURE 5-5: The Layout Inspector gives you significant detail about ...
FIGURE 5-6: A list of styles that an
<item>
can modify.
FIGURE 5-7: Choosing a button style during design time.
FIGURE 5-8: Use a color chooser to change a color style directly.
FIGURE 5-9: Rely on standard or custom color selections for your pro...
FIGURE 5-10: Accessing emoji using the keyboard in an Android app.
FIGURE 5-11: Displaying emoji in a
TextView
.
FIGURE 5-12: Copying and pasting emoji into your
strings.xml
file.
FIGURE 5-13: Viewing the result of cutting and pasting in a standar...
FIGURE 5-14: Accessing the special emoji controls.
FIGURE 5-15: Comparing pasted emoji to Unicode emoji.
Book 4 Chapter 1
FIGURE 1-1: Playing Hungry Burds.
FIGURE 1-2: Showing one Burd after another.
FIGURE 1-3: Positioning a view in a constraint set.
Book 4 Chapter 2
FIGURE 2-1: The simple Facebook app starts running.
FIGURE 2-2: Logging in to Facebook.
FIGURE 2-3: The Share dialog.
FIGURE 2-4: A new Facebook post.
FIGURE 2-5: Nudging users to mention your pages.
FIGURE 2-6: Previewing a web page.
FIGURE 2-7: No reason to mention the Dummies Store a second time.
FIGURE 2-8: An Android spinner.
FIGURE 2-9: Waiting for a web page.
Book 4 Chapter 3
FIGURE 3-1: Locate the three tools needed to implement native code s...
FIGURE 3-2: When necessary, you can choose specific tool versions.
FIGURE 3-3: Choose an older version of the package when needed.
FIGURE 3-4: Verify that you are installing the packages you need.
FIGURE 3-5: The SDK Quickfix Installation tells you about installati...
FIGURE 3-6: Installing NDK provides you with a new project type as w...
FIGURE 3-7: Choose a version of C++ to use.
FIGURE 3-8: The Android Project window contains some additions.
FIGURE 3-9: The IDE provides the location of the folder you point at...
FIGURE 3-10: Using Project view to locate a folder.
FIGURE 3-11: Seeing the C++ string output.
Book 5 Chapter 1
FIGURE 1-1: Emulator controls let you reconfigure the device.
FIGURE 1-2: The example doesn’t rotate when turned.
FIGURE 1-3: Test simultaneously in portrait and landscape mode by ha...
FIGURE 1-4: Tablets can have four times the screen real estate of sm...
FIGURE 1-5: The example app doesn’t scale well, either.
FIGURE 1-6: Define a range of device sizes and orientations to ensur...
FIGURE 1-7: Accessing the multiple-device capability.
FIGURE 1-8: Choose which devices to use for the emulation.
FIGURE 1-9: Rename the package instances in your app.
FIGURE 1-10: Define how you want the rename process to proceed.
FIGURE 1-11: Verify the refactoring process.
FIGURE 1-12: Look for the little orientation symbol on you emulator...
FIGURE 1-13: The app now reorients itself correctly.
FIGURE 1-14: Using a different layout makes the design more flexibl...
FIGURE 1-15: The new layout works great on a smartphone no matter t...
FIGURE 1-16: Tablets can now use the layout as well and the viewer ...
FIGURE 1-17: An augmentation of the original Book 3, Chapter 3 desi...
FIGURE 1-18: Define the new links for the updated design.
FIGURE 1-19: An updated graph that considers a more complex process...
FIGURE 1-20: Seeing Destinations from within the nested graph.
FIGURE 1-21: Reorganize the layout to place all controls on
activit
...
FIGURE 1-22: Add button information to each destination.
FIGURE 1-23: Add arguments to handle the button text.
FIGURE 1-24: The fragments now have only content, so you can easily...
Book 5 Chapter 2
FIGURE 2-1: The Wear OS templates focus on watches.
FIGURE 2-2: Define the basic parameters of the app you want to creat...
FIGURE 2-3: Already an error and you haven't even touched anything!
FIGURE 2-4: The Wear OS category contains only a few basic types.
FIGURE 2-5: Select one of the recommended options for best performan...
FIGURE 2-6: The configuration used for the examples in this chapter.
FIGURE 2-7: A quick test of your environment.
FIGURE 2-8: You must reconfigure the run conditions.
FIGURE 2-9: Access the emulator’s Settings menu.
FIGURE 2-10: Choose to see more watch faces.
FIGURE 2-11: Locate the newly created watch face.
FIGURE 2-12: The emulator is using the new watch face.
FIGURE 2-13: The skeletal watch face app with the date display adde...
Book 5 Chapter 3
FIGURE 3-1: Android Studio's skeletal TV app.
FIGURE 3-2: You see this emulator screen when your app isn’t running...
FIGURE 3-3: The skeletal app's main activity.
FIGURE 3-4: Start your app manually when required.
FIGURE 3-5: You've scrolled to one of the videos.
FIGURE 3-6: Some preferences.
FIGURE 3-7: Adapters, presenters, and other good stuff.
Book 5 Chapter 4
FIGURE 4-1: Android Emulator tools you need to work with Android Aut...
FIGURE 4-2: Verify that you’re installing the right features.
FIGURE 4-3: Ensure that you have the full version of Android 9.0 (Pi...
FIGURE 4-4: Change the channel used for updates.
FIGURE 4-5: Obtain the updates needed for this project.
FIGURE 4-6: Obtain the updates needed for this project.
FIGURE 4-7: Complete the Canary Channel version setup process.
FIGURE 4-8: Choose the emulator you want.
FIGURE 4-9: As with any emulator, you need a system image.
FIGURE 4-10: Select an automotive project template.
FIGURE 4-11: Parts of an Android Auto app.
FIGURE 4-12: Reconfiguring the correct app.
FIGURE 4-13: The app’s home page, where you can choose an audio sou...
FIGURE 4-14: Seeing how the browse feature will likely work in a co...
FIGURE 4-15: Choosing one of the installed apps.
Book 6 Chapter 1
FIGURE 1-1: The Configure Image Asset dialog box.
FIGURE 1-2: The Confirm Icon Path dialog box.
FIGURE 1-3: Getting a screenshot.
FIGURE 1-4: Bundle or APK?
FIGURE 1-5: A bunch of questions about keys and key stores.
FIGURE 1-6: The New Key Store dialog box.
FIGURE 1-7: Filling in the fields of Figure 1-5.
FIGURE 1-8: The penultimate step.
FIGURE 1-9: Finding the APK file.
FIGURE 1-10: Selecting a build variant.
FIGURE 1-11: Creating a signing configuration.
FIGURE 1-12: Don't even think about it! This screenshot's passwords...
FIGURE 1-13: Connecting a signing configuration to a build.
Cover
Table of Contents
Begin Reading
i
ii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
As the year 2019 drew to a close, Android ran on 51.8 percent of all smartphones in the United States and on 85 percent of all smartphones worldwide.1,2 The Google Play Store had 2.57 million apps compared with only 1.84 million in Apple's App Store.3
Today, Android is everywhere, and experts predict that Android will dominate the global smartphone market for years to come.4 So, if you read this book in a public place (on a commuter train, at the beach, on the dance floor at the Coyote Ugly saloon), you can read proudly, with a chip on your shoulder and with your chest held high. Android is hot stuff, and you’re cool because you’re reading about it.
You can attack this book in either of two ways. You can go cover to cover, or you can poke around from one chapter to another. You can even do both (start at the beginning and then jump to a section that particularly interests you). In this book, the basic topics come first, and the more involved topics follow the basics. You may already be comfortable with some basics, or you may have specific goals that don’t require you to know about certain topics.
The best advice is as follows:
If you already know something, don’t bother reading about it.
If you’re curious, don’t be afraid to skip ahead. You can always sneak a peek at an earlier chapter if you really need to do so.
Almost every technical book starts with a little typeface legend, and this book is no exception. What follows is a brief explanation of the typefaces used in this book:
New terms are set in
italics
.
If you need to type something that’s mixed in with the regular text, the characters you type appear in bold. For example: “Type
MyNewProject
in the text field.”
You see this
computerese
font for Kotlin code, filenames, web page addresses (URLs), onscreen messages, and other such things. Also, if something you need to type is really long, it appears in
computerese
font on its own line (or lines).
You need to change certain things when you type them on your own computer keyboard. For instance, the instructions may ask you to type
public void Anyname
which means that you type public void and then some name that you make up on your own. Words that you need to replace with your own words are set in italicized computerese.
This book makes a few assumptions about you, the reader. If one of these assumptions is incorrect, you're probably okay. If all these assumptions are incorrect … well, buy the book anyway.
The assumptions are as follows:
You can navigate through your computer’s common menus and dialog boxes. You don’t have to be a Windows, Macintosh, or Linux power user, but you should be able to start a program, find a file, put a file into a certain folder … that sort of thing. Much of the time, when you practice the stuff in this book, you’re typing code on your keyboard, not pointing and clicking your mouse.
You can think logically. That’s all there is to application development — thinking logically. If you can think logically, you have it made. If you don’t believe that you can think logically, read on. You may be pleasantly surprised.
You have some programming experience (maybe not a lot). This book should be interesting for experienced programmers, yet accessible to people who don’t write code for a living. If you’re a programming guru, that’s great. If you’re a certified Linux geek, that’s great, too. But no one expects you to be able to recite the names of Kotlin’s concurrency primitives in your sleep, or pipe together a chain of 14 Linux commands without reading the documentation.
By the way, if you have no experience with an object-oriented language, you can get some. Your favorite bookstore has a terrific book titled Java For Dummies, 7th Edition, by Barry Burd (John Wiley & Sons, Inc.). The book comes highly recommended.
Throughout this book, an icon in the margin marks the beginning of a little detour — a fact or tidbit that stands out for one reason or another. The paragraphs marked by icons differ in their degree of importance. Some are valuable reading, others are silly trivia, and many are somewhere in the middle.
What kinds of icons do you find in this book? Here’s a list:
A Tip is an extra piece of information — something helpful that the other books may forget to tell you.
A Warning icon describes a mistake that many people make. Don't interpret the icon to mean, “Never make this mistake.” That would be unreasonable. Instead, think of the icon as a word of comfort. It says, “Like everyone else, you'll probably make this mistake. When you do, remember that you once read about it here. Return to this section if you feel so inclined.”
Question: What’s stronger than a Tip, but not as strong as a Warning?
Answer: A Remember icon.
Each Technical Stuff icon introduces an interesting fact. Some of these facts help you understand the reasoning behind the design of Android. You don’t have to read all the Technical Stuff icons, but you may find them useful. They're especially helpful if you plan to read other (geekier) books about Android app development.
You’ve read the Android All-in-One book, seen the Android All-in-One movie, worn the Android All-in-One T-shirt, and eaten the Android All-in-One candy. What more is there to do?
That’s easy. Just visit this book’s website — www.allmycode.com/Android. At the website, you can find updates, comments, additional information, and lots of downloadable code. (You can also get there by visiting www.dummies.com and searching for Android Application Development All-in-One For Dummies, 3rd Edition.
Also on this book’s page at www.dummies.com is the Cheat Sheet, which provides you with hints you need for nearly every Android app, such as parts of an Android app and the contents of that all important .apk file. You also get quick reminders about navigation classes, parts of a notification, and user interface elements.
If you've gotten this far, you’re ready to start reading about Android application development. Think of us (this book's authors) as your guides, your hosts, your personal assistants. We do everything we can to keep things interesting and, most important, help you understand.
If you experience any problems at all with this book, please contact either or both of us: Barry ([email protected]) or John ([email protected]) for assistance. We want you to be truly happy with your purchase and will help in any way we can with book-specific questions. You can also contact Barry on Twitter (@allmycode) and Facebook (www.facebook.com/allmycode).
Occasionally, we have updates to our technology books. If this book does have technical updates, they will be posted at this book’s page at www.dummies.com and at http://allmycode.com/android.
1
See
www.statista.com/statistics/266572/market-share-held-by-smartphone-platforms-in-the-united-states/
.
2
See
https://hostingtribunal.com/blog/operating-systems-market-share/#gref
.
3
See
statista.com/statistics/276623/number-of-apps-available-in-leading-app-stores/
.
4
See
www.idc.com/promo/smartphone-market-share/os
.
Book 1
Chapter 1: All about Android
The Consumer Perspective
The Versions of Android
The Developer Perspective
The Business Perspective
Chapter 2: Installing the Software Tools
Setting Up the Software
Launching the Android Studio IDE
Fattening Up the Android SDK
Chapter 3: Creating an Android App
Creating Your First App
Running Your App
You Can Download All the Code
Troubleshooting Common IDE Errors
Testing Apps on a Real Device
Chapter 4: Examining a Basic Android App
A Project’s Files
The MainActivity.kt file
The res Branch
Other Files in an Android Project
What Did I Agree To?
Chapter 5: Conjuring and Embellishing an Android App
Dragging, Dropping, and Otherwise Tweaking an App
A Bit of Debugging
Chapter 6: Improving Your App
Improving the Layout
Starting Another Activity
Localizing Your App
Responding to Check Box Events
Displaying Images
Sending in Your Order
Chapter 1
IN THIS CHAPTER
Your take on Android (depending on who you are)
A tour of Android technologies
Until the mid-2000s, the word “Android” stood for a mechanical humanlike creature — a rootin’ tootin’ officer of the law with built-in machine guns, or a hyperlogical space traveler who can do everything except speak using contractions. But in 2005, Google purchased Android, Inc. — a 22-month-old company creating software for mobile phones. That move changed everything.
In 2007, a group of 34 companies formed the Open Handset Alliance. The Alliance's task was (and still is) “to accelerate innovation in mobile and offer consumers a richer, less expensive, and better mobile experience.” The Alliance's primary project is Android — an open, free operating system based on the Linux operating system kernel.
HTC released the first commercially available Android phone near the end of 2008, but the public's awareness of Android and its potential didn't surface until early 2010. By the mid-2010s, the world had more than 400 Android device manufacturers with 500 mobile carriers using Android and 1.5 million Android activations each day (https://expandedramblings.com/index.php/android-statistics/). By mid-2019, more than 2.5 billion active devices ran the Android operating system (https://venturebeat.com/2019/05/07/android-passes-2-5-billion-monthly-active-devices/). (We know. By the time you read this book, the year 2019 is old news. That's okay.)
This chapter introduces Android. The chapter examines Android from a few different angles.
A consumer considers the mobile phone alternatives.
Possibility #1: No mobile phone.
Advantages:
Inexpensive. No junk calls. No interruptions. No GPS tracking or snooping by businesses or other agencies.
Disadvantages:
No instant contact with friends and family. No calls to services in case of an emergency. No hand-held games, no tweeting, tooting, hooting, homing, roaming, or booping. And worst of all, to break up with your boyfriend or girlfriend, you can't simply send a text message.
Possibility #2: A feature phone — a mobile phone that's not a smartphone.
Advantages:
Cheaper than a smartphone.
Disadvantages: Not as versatile as a smartphone. Not nearly as cool as a smartphone. Nowhere near as much fun as a smartphone.
There's no official rule defining the boundary between feature phones and smartphones. But generally, a feature phone is one with an inflexible menu of home-screen options. A feature phone's menu items relate mostly to traditional mobile phone functions, such as dialing, texting, and maybe some limited web surfing and gaming. In contrast, a smartphone's home screen provides access to the underlying file system and has icons, customizable skins, and many other features that used to be available only to general-purpose computer operating systems.
Don't write off feature phones. As late as March 2019, Counterpoint Research predicted that people will buy a billion feature phones between 2019 and 2022 (https://www.counterpointresearch.com/more-than-a-billion-feature-phones-to-be-sold-over-next-three-years/). This fact may shock you if you live in a country where feature phones are passé. But in 2019, the worldwide feature phone continued to grow.
Possibility #3: An iPhone.
Advantages:
Great graphics.
Disadvantages:
Little or no flexibility with the single-vendor iOS operating system. Only a handful of different models to choose from. No sanctioned “rooting,” “modding,” or “jailbreaking” the phone. And then there is the potential cost of an iPhone when compared to Android phones.
Possibility #4: An Ubuntu Touch phone, a Harmony OS phone, or some other non-Android, non-Apple smartphone.
Advantages:
Having a smartphone without belonging to a crowd.
Disadvantages:
Relatively difficult to get technical support. Not nearly as many apps as Android phones and Apple phones. Smaller selection of hardware to choose from.
Possibility #5: An Android phone.
Advantages:
Using an open platform. Using a popular platform with lots of industry support and with powerful market momentum. Writing your own software and installing the software on your own phone (without having to deal with Apple as an intermediary). Access to a broad range of hardware and price points. Publishing software without facing the challenging approval process used by Apple, plus you can choose not to use the Google Play Store (see
https://www.knowband.com/blog/mobile-app/alternatives-for-publishing-android-app-on-google-play-store/
for alternative ideas).
Disadvantages:
Security concerns when using an open platform. Confusion about the variety of manufacturers, each with different hardware and with some changes to the Android platform. Dismay when iPhone users make fun of your phone.
Android's advantages far outweigh the possible disadvantages. And you're reading a paragraph from Android Application Development All-in-One For Dummies, 3rd Edition, so you're likely to agree.
Having decided to go with an Android phone, the consumer asks, “Which phone?” And the salesperson says, “This phone comes with Android 10.” (If you read between the lines, what the salesperson really means is “This phone comes with Android 9, which will eventually be upgraded to Android 10, or so claims the vendor.”) So the consumer asks, “What are the differences among all the Android versions?”
Android comes with a few different notions of “version.” Android has platform numbers, API levels, codenames, and probably some other versioning schemes. (The acronym API stands for Application Programming Interface — a library full of prewritten programs available for use by a bunch of programmers. In this case, the “bunch” consists of all Android developers.)
To complicate matters, the versioning schemes don't increase in lockstep. For example, Android 8 (codenamed Oreo) has two API levels — levels 26 and 27. But Android 9 (codenamed Pie) has only one API level — level 28.
An Android version may have variations. For example, you can develop for plain old API Level 29 with an established set of features. To plain old API Level 29, you can add the Google APIs (thus adding Google Maps functionality) and still be using platform API Level 29. You can also add a special set with features tailored for a particular device manufacturer or a particular mobile service provider.
API levels 3 through 28 had tasty dessert codenames, and the names came in alphabetical order. For example, after Lollipop came Marshmallow; after Marshmallow came Nougat. Sad to say, the last-ever Android dessert codename was Pie, released in August 2018. About a year later, Google released a newer version simply named Android 10. The number 10 doesn't taste good the way lollipops and pies do.
Figure 1-1 has a summary of Android's API versions from 2008 to 2019.
A few notes on Figure 1-1 are in order:
The platform number is of interest to the consumer and to the company that sells the hardware.
If you’re buying a phone with Android 9.0, for example, you might want to know whether the vendor will upgrade your phone to Android 10.0.
The API level (also known as the SDK version) is of interest to the Android app developer.
For example, in API level 8.1, the word
Build.SERIAL
stands for the phone's serial number. So, you might be tempted to type
Build.SERIAL
in code that uses API level 9.0. But in API level 9.0,
Build.SERIAL
doesn't help you get a phone's serial number. In API level 9.0, the value of
Build.SERIAL
is
"UNKNOWN"
.
The codename is of interest to the creators of Android.
A
codename
(also known as the
version code
) refers to the work done by the creators of Android to bring Android to the next level. Picture Google's engineers working for months behind closed doors on Project Oreo, and you'll be on the right track.
Since 2016, a new version of Android has come roughly once a year. Google released Nougat in 2016, Oreo in 2017, Pie in 2018, and the sugarless Android 10 in 2019. As a developer, your job is to balance portability with feature richness. When you create an app, you specify a minimum Android version. (You can read more about specifying a minimum version in Chapter 4 of this minibook.) The higher the version, the more features your app can have. But the higher the version, the fewer the devices that can run your app.
FIGURE 1-1: Android version history.
This book contains tips and tricks for striking a happy medium between whiz-bang features and universal use, and Google has some nifty tools to help you sort out the differences among Android versions. In Chapter 3 of this minibook, you use Android Studio to create your first app. During the app setup, a drop-down box gives you a choice of Android versions for your app. Beneath that drop-down box is an innocent-looking Help Me Choose link. If you click this link, you see a page with the title Android Platform/API Version Distribution. This interactive page lists several of the most recent Android versions along with the percentage of phones that can run each version. And, when you click one of the Android versions, the page provides information about that version's features.
Storks and fairies don't install updates on your Android devices. The updates come via Wi-Fi or phone service through your carrier or device manufacturer. But by downloading and installing an independently developed Android release, you can break free of the corporate giants. For information about these independently developed releases, visit http://forum.xda-developers.com/custom-roms.
Android is a multifaceted beast. When you develop for Android, you use many tool sets. This section gives you a brief rundown of those tool sets.
James Gosling from Sun Microsystems created the Java programming language in the mid-1990s. (Sun Microsystems has since been bought out by Oracle.) Java's meteoric rise in use came from the elegance of the language and the well-conceived platform architecture. After a brief blaze of glory with applets and the web, Java settled into being a solid, general-purpose language with special strength in servers and middleware.
In the meantime, Java was quietly seeping into embedded processors.
An embedded processor is a computer chip that's hidden from the user as part of some special-purpose device. The chips in today's cars are embedded processors, and the silicon that powers your photocopier at work is an embedded processor. Pretty soon, the flowerpots on your windowsill will probably have embedded processors. By 2002, Sun Microsystems was developing Java ME (Mobile Edition) for creating MIDlets based on the Mobile Information Device Profile (MIDP) to run on mobile phones in a manner similar to applets on a web page (see https://www.techopedia.com/definition/116/midlet for details). Java became a major technology in Blu-ray disc players, parking meters, teller machines, and other devices. So, the decision to make Java the primary development language for Android apps was no big surprise.
The trouble was, not everyone agreed about the fine points of Java's licensing terms. The Java language isn't quite the same animal as the Java software libraries, which in turn aren't the same as the Java Virtual Machine (the software that enables the running of Java programs). So, in marrying Java to Android, the founders of Android added an extra puzzle piece — the Dalvik Virtual Machine (see the “What is Dalvik” sidebar in Book 2, Chapter 3 for details). And instead of using the official Sun/Oracle Java libraries, Android used Harmony — an open-source Java implementation from the Apache Software Foundation. Several years and many lawsuits later, Google and Oracle were still at odds over the use of Java in Android phones.
Programmers always use one kind of software to develop other kinds of software. For several years, programmers had developed Android apps using software named Eclipse. In the meantime, a competing product named IntelliJ IDEA was growing in popularity. A group of engineers from Google and IntelliJ IDEA's parent company (JetBrains) cooperated to create a very lean version of IntelliJ IDEA. Simply put, they removed the features of IntelliJ IDEA that Android developers would never use. From this stripped-down version of IntelliJ IDEA, they created a customized product especially for Android programmers. At its annual developer conference in 2013, Google introduced Android Studio — the shiny new tool to help Android developers be more productive.
For everything you need to know about installing Android Studio, see Chapter 2 in this minibook. For instructions on using Android Studio, see Book 1, Chapter 3 and Book 2, Chapter 1.
Also at the aforementioned 2013 developer conference, Google began the process of replacing Dalvik with a new virtual machine named Android Runtime, or ART. Programs ran faster under ART, plus they consumed less memory and less power, and they were easier to debug. The transition from Dalvik to ART was a first step in the separation of Android from Oracle's proprietary Java technologies. (For more information about the Dalvik Virtual Machine and ART, see Book 2, Chapter 3.)
While Android matured, new programming languages were making improvements on many of Java's long-standing features. Apple was developing Swift to replace the aging Objective-C language. With Swift and other such languages, developers had a natural way of controlling how values may change during the run of a program. Developers could easily extend existing functionality and create code to tame null values — values that expert Tony Hoare had dubbed a “billion-dollar mistake.” In newer languages, programmers used built-in features to write code in a functional style (a coding technique that expresses computational goals in the form of math functions) — a style that Book 2, Chapter 6 covers in detail.
JetBrains was developing one of these new languages. The language's name — Kotlin — came from the name of an island near St. Petersburg in Russia. Kotlin borrowed many of Java's features and improved on them in significant ways. At its annual developer conference in 2017, Google announced support for creating Android programs using Kotlin.
A year later, 35 percent of all Android programmers were using Kotlin. In 2019, Google officially dubbed Kotlin as the preferred language for Android app development.
Kotlin is fully compatible with Java. So, when you create an Android app, you can borrow pieces of programs written in Java and meld them seamlessly with your Kotlin code. Kotlin also integrates with JavaScript, so developers can write Kotlin programs that drive web pages. Behind the scenes, Kotlin plays nicely with Node.js — a widely used platform that runs on servers around the world. You can even translate Kotlin into native code — code that runs on Windows, macOS, Linux, and other operating systems.
Kotlin is deeply entrenched in the Android ecosystem and in other systems as well. If you already have some Kotlin programming experience, great! If not, you can find a fast-paced introduction to Kotlin in Book 2, Chapters 2 through 4. The time you invest in developing mobile Kotlin-based apps will continue to pay off for a long, long time.
If you find View Source among your web browser's options, you see a bunch of Hypertext Markup Language (HTML) tags that represent the coding for a web page. A tag is some text enclosed in angle brackets. The tag describes something about its neighboring content.
For example, to create boldface type on a web page, a web designer writes
<b>Look at this!</b>
The angle-bracketed b tags turn boldface type on and off.
The M in HTML stands for Markup — a general term describing any extra text that annotates a document's content. When you annotate a document's content, you embed information about the document's content into the document itself. So, for example, in the line of code in the previous paragraph, the content is Look at this! The markup (information about the content) consists of the tags <b> and </b>.
The HTML standard is an outgrowth of SGML (Standard Generalized Markup Language). SGML is an all-things-to-all-people technology for marking up documents for use by all kinds of computers running all kinds of software and sold by all kinds of vendors.
In the mid-1990s, a working group of the World Wide Web Consortium (W3C) began developing XML — the eXtensible Markup Language. The working group's goal was to create a subset of SGML for use in transmitting data over the Internet. The group succeeded. Today, XML is a well-established standard for encoding information of all kinds. Java is good for describing step-by-step instructions, and XML is good for describing the way things are (or should be). A Java program says, “Do this and then do that.” In contrast, an XML document says, “It's this way, and it's that way.” Android uses XML for two purposes:
To describe an app's data: