Errata

Head First Android Development

Errata for Head First Android Development

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page Ch. 1
1st paragraph

"In this chapter, you’ll find out how to start turning your ideas into reality by is the world’s most popular mobile operating system.building a basic Android app, and updating it."

There's a repeated sentence that was mentioned earlier in the middle of this sentence.
Should be updated to:

"In this chapter, you’ll find out how to start turning your ideas into reality by building a basic Android app, and updating it."

Note from the Author or Editor:
This is on page 1

Michael Sim  Nov 22, 2021  Jan 21, 2022
Page Ch. 1
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch01.html#the_story_so_far

Q: How much do I need to know about Gradle?

A: You don’t need any Gradle experience to get the most out of this book. We’ll explain everything you need to know [as] and when it’s needed.

---

The word "as" should be removed since "you need to know as and when it's needed" doesn't make sense.

Note from the Author or Editor:
p16 final answer in the NDQ. The last sentence can be changed to "We’ll explain everything you need to know when it’s needed".

Michael Sim  Nov 22, 2021  Jan 21, 2022
Page Ch. 1
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch01.html#the_story_so_far

WHAT’S MY PURPOSE SOLUTION?

---

In the previous section, it makes sense to end with a question mark: "WHAT'S MY PURPOSE?" But the solution text heading should end without a question mark.

Note from the Author or Editor:
The formatting for this should match the printed book, where the "?" goes after the "What's my Purpose".

Michael Sim  Nov 22, 2021  Jan 21, 2022
Page Ch. 2
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch02.html#test_drive-id00011

Q: You said you can add views through the design editor or by editing the XML. Which approach is best?

A: It’s mostly a matter [a] personal preference. For simple layouts, we prefer to update the underlying XML, but you’ll find out in Chapter 4 that some types of layout are easier to update if you use the design editor.

---

[a] should be replaced with "of"

Previous: It's mostly a matter a personal preference.
Proposed fix: It's mostly a matter of personal preference.

Note from the Author or Editor:
This is page 49 in the answer to the first NDQ.

Michael Sim  Nov 29, 2021  Jan 21, 2022
Page Ch. 2
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch02.html#pool_puzzle

Problem: There should be six ........ fill in the blanks. But there are only five:

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val findBeer = findViewById<Button>(R.id.find_beer)
findBeer............................{
val beerColor = findViewById<Spinner>(....................)
val color = beerColor.
val brands = findViewById<............>(R.id.brands)
brands.........= "Beer color is........................."
}
}

--

Solution:

The missing blank is:

val color = beerColor....................

Note from the Author or Editor:
There are six blanks in the printed version of the book (p69). The Safari version needs to be the same.

Michael Sim  Dec 01, 2021  Jan 21, 2022
Page Ch. 3
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch03.html#hellipand_a_viewgroup_is_a_type_of_view

Issue: The image that's tied to the below description is in the wrong place. It appears three paragraphs later when it should precede the description below.

"Every UI component you add to a layout is a type of View: an object that takes up space on the screen.

Every layout is a type of ViewGroup: a type of View that can contain other Views.

She’s right"

---

Suggestion: Move the image above the description.

Note from the Author or Editor:
The formatting needs to match page 114 of the printed book so the image and thought bubble go before "she's right".

Michael Sim  Dec 06, 2021  Jan 21, 2022
Page Ch. 4
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch04.html#nested_layouts_revisited

The [down side] to nested layouts is that building complex layouts in this way can be inefficient, make your code harder to read and maintain, and can also slow down your app.

---

Explanation: A minor typo. Should be a single word, "downside".

Note from the Author or Editor:
This is on page 123.

Michael Sim  Dec 07, 2021  Jan 21, 2022
Page Ch. 4
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch04.html#test_drive-id00047

The text "She's right" and the explanation appears before the picture that it references. So instead of:

She’s right.

Constraint layouts can include both horizontal and vertical chains, and a single view can belong to both types. You can use this to arrange views in a grid.

<picture of a girl with thought bubble>

---

The following suggestion would make more sense because it first shows the picture, the reader reads it, and thinks about it, and then reads the text explanation whereas before, they saw the explanation first and then the picture (note that in this ordering, "below" in the third paragraph is now changed to "above" since location of the picture is changed):

<picture of a girl with thought bubble saying, "... Is it possible for a view to belong to a horizontal chain and a vertical one? ...">

She’s right.

Constraint layouts can include both horizontal and vertical chains, and a single view can belong to both types. You can use this to arrange views in a grid.

The blueprint [above], for example, shows six buttons arranged in a grid. Each row is a horizontal chain, and the leftmost buttons form a vertical chain:

Note from the Author or Editor:
The formatting needs to match page 161 of the printed book so that the chracter asks a question, this is answered, and it's followed by the diagram.

Michael Sim  Dec 10, 2021  Jan 21, 2022
Page Ch. 4
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch04.html#your_android_toolbox-id00051

In the last section, the bullet point about barrier can be simplified by either using "as" or "when".

Currently:

A barrier moves as and when its views change size.

---

Suggestion:

A barrier moves as its views change size.

Note from the Author or Editor:
This is on page 168, and relates to the top-right bullet.

Michael Sim  Dec 10, 2021  Jan 21, 2022
Page Ch. 5
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch05.html#what_happens_when_you_run_the_app

There are two issues in this paragraph:

"The user clicks the Start button.
The stopwatch.[b]ase property is set to SystemClock.elapsedRealTime(), its start() method is called, and running is set to true. The stopwatch starts running."

1. There’s a minor font styling issue where the “b” in the code “stopwatch.base” is using the regular font. It should be using the code styling (highlighted in grey with monospaced font).

2. Instead of the capitalized “T” in elapsedRealTime(), it should be in lowercase: SystemClock.elapsedRealtime(). Please note that this issue happens once again here:

"The user clicks the Reset button.
The offset property is set to 0, and the stopwatch.base property is reset to SystemClock.elapsedRealTime()."

Note: There are four occurrences of "SystemClock.elapsedRealtime()" in chapter 5. Two are incorrect as mentioned in #2 above, but the other two occurrences are correctly using the lowercase.


Note from the Author or Editor:
On page 176, section 3, "stopwatch.base" should all be in code font, and "elapsedRealTime()" should be "elapsedRealtime()" with a lower case t.

On page 177, section 6, "elapsedRealTime()" should be "elapsedRealtime()" with a lower case t.

Michael Sim  Dec 16, 2021  Jan 21, 2022
Page Ch. 5
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch05.html#startcomma_stopcomma_and_restart

This sentence is a bit confusing read (it feels like there's a word missing):

"Specifically, there are three key lifecycle methods that deal with when an activity becomes visible or invisible to the user: onStart(), onStop(), and onRestart()."

[that deal with when an activity becomes]

Suggestion #1:
"Specifically, there are three key lifecycle methods that deal with an activity when it becomes visible or invisible to the user..."

Suggestion #2:
"Specifically, there are three key lifecycle methods that runs when an activity becomes visible or invisible to the user..."

Other word option instead of "deal with":

interact with


Note from the Author or Editor:
Page 193, second paragraph in the "Start, stop, and restart" section.

Change "Specifically, there are three key lifecycle methods that deal with..." to "Specifically, there are three key lifecycle methods that can run..."

Michael Sim  Dec 16, 2021  Jan 21, 2022
Page Ch. 5
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch05.html#what_happens_when_you_run_the_ap-id00064

In the exercise description, it says "on the right" (once in the question and in the answer) which might be true in the book, but when reading the book online, the code is not on the right, it's shown below.

"The activity code on the right changes the value of a property named x at various stages of the activity lifecycle. See if you can determine which lifecycle methods get called and the final value of x after each of the actions below."

---

Solution: Instead of using specific language like it's on the right, just saying something like this also works:

"The activity code shown here changes the value of a property ..."

Note: Again, the solution has the same sentence so when fixing this, modify both places.

Note from the Author or Editor:
This is for pages 200 and 202 in the printed book.

Saying "on the right" makes sense in the print copy, but the online book is formatted differently. Is it possible to rephrase this to "shown below" for the online book only, and keep it the same for the printed book?

Michael Sim  Dec 16, 2021  Jan 21, 2022
Page Ch. 5
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch05.html#what_if_an_activity_is_only_partially_vi

This sentence was awkward to read:

"There are two lifecycle methods that handle when the activity is paused and when it becomes active again"

---

Suggestion:

"There two lifecycle methods that handle the activity when it is paused and when it becomes active again"

Note from the Author or Editor:
p204 final paragraph.

Change "There are two lifecycle methods that handle..." to "There are two lifecycle methods that get involved..."

Michael Sim  Dec 16, 2021  Jan 21, 2022
Page Ch. 5
https://learning.oreilly.com/library/view/head-first-android/9781492076513/ch05.html#be_the_activity

In the "BE the Activity" exercise, it refers to the "right" when there's nothing on the right (at least in the online version):

"On the right, you’ll see some activity code. Your job is to play like you’re the activity and say which code will run in each of the situations below. We’ve labeled the code we want you to consider. We’ve done the first one to start you off."

This happens again in the solution part of this exercise.

---

Suggestion: Remove the first sentence. It still works fine without it.

"Your job is to play like you’re the activity and say which code will run in each of the situations below. We’ve labeled the code we want you to consider. We’ve done the first one to start you off."

Note from the Author or Editor:
This looks like a formatting issue with the online book. The text needs to stay the same, but the online formatting needs to be looked at.

Michael Sim  Dec 16, 2021  Jan 21, 2022
Page general
general

Looks like there is no updated source for 3rd edition on Github?

Note from the Author or Editor:
The source code for all the book's projects will be available from tinyurl.com/hfad3 by the time the book is published.

Anonymous  Apr 28, 2021  Nov 18, 2020
Printed
Page 12, 13, 55, 238, 406, 447, 624, 650
The bullets

The star symbols inside the bullets should be centered.

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 29
The "It's quite small" annotation on the screenshot

The annotation needs to be moved up very slightly so that it's not crashing into the arrow.

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 80
5th bullet

Change "Value" to "string".

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 85
2nd paragraph

Change "its appearance and behavior" to "the layout's appearance and behavior"

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 93
Bottom annotation

Move the annotation down slightly so that it's further away from the body text.

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 93
Annotation on the screenshot

Move the annotation and arrow up so that the arrow points to the text on the screenshot.

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 95
The paragraph above the block of code

"Here's" should have a curly '.

Dawn Griffiths
Dawn Griffiths
 
Jan 15, 2022  Jan 21, 2022
Printed
Page 103
Bottom annotation

The arrow on the right is too far away from the annotation text. This can probably be fixed by making the annotation text frame wider.

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 109
The code underneath the "How to define a frame layout" section.

The first line:
<FrameLayout "xlmns:android...
should be
<FrameLayout xmlns:android...
(remove the first " in the line)

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 127
First paragraph

At the end of the first line, it looks like there's a space before the second --.

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 177
Bullet 5

There are too many spaces between "the" and "stopwatch".

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 199
NDQs, first question

There's a space missing after the first "Q:" in the NDQs.

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 239
First paragraph

On lines 2 and 3, "build.gradle" has been split onto separate lines and should be kept together.

Dawn Griffiths
Dawn Griffiths
 
Jan 07, 2022  Jan 21, 2022
Printed
Page 257
line 3

The text has got a bit jumbled. Please remove the extraneous "need extra information to work properly." on line 3.

Dawn Griffiths
Dawn Griffiths
 
Jan 07, 2022  Jan 21, 2022
Page 267
4th paragraph

classpath "androidx.navigation:navigation-safe-args-gradle-plug-in:$nav_version"
- the "plug-in" near the end should be "plugin" like below.

classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"


Jake Sanderson  Dec 15, 2021  Jan 21, 2022
Printed
Page 267
"Add the plug-in to the app build.gradle file" section

At the end of the first paragraph and in the code, it says "plug-ins". This should be changed to "plugins".

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 293
Line 5

Change the comma after "toolbar" to a full-stop.

Dawn Griffiths
Dawn Griffiths
 
Jan 07, 2022  Jan 21, 2022
Printed
Page 330
The block of code

The block of code is a bit too close to the body text above it. Please move the code block (along with the annotations and arrows) down slightly so it's more evenly spaced between the blocks of body text.

Dawn Griffiths
Dawn Griffiths
 
Jan 07, 2022  Jan 21, 2022
Printed
Page 383
Bottom-left annotation

"iInput" should be "Input"

Dawn Griffiths
Dawn Griffiths
 
Jan 07, 2022  Jan 21, 2022
Printed
Page 385
Bottom annotation

The annotation arrow needs to be moved slightly so it's not crashing into the body text.

Dawn Griffiths
Dawn Griffiths
 
Jan 07, 2022  Jan 21, 2022
Printed
Page 418, 431
3rd line down in the body text

"{with" should be "(with"

Dawn Griffiths
Dawn Griffiths
 
Jan 07, 2022  Jan 21, 2022
Printed
Page 441

In the line of code starting with "classpath", replace "plug-in" with "plugin".

The text frame should also be made wider so that the trailing version" fits on the same line.

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 441
"…and update the app build.gradle file too" section

In the code section, replace "plug-ins" with "plugins"

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 444
First annotation on the left

It should be "back stack", not "backs tack".

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 444
Last paragraph

The ' in "let's" should be curly.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 472
Relax element

The bottom border of the Relax box can be moved up. It looks a bit gappy.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 491
The code line beginning "fun isWon()"

The ".value" in this line should be bold.

Add an annotation (with an arrow pointing to the ".value") that says "We need to use .value here too."

Dawn Griffiths
Dawn Griffiths
 
Jan 15, 2022  Jan 21, 2022
Printed
Page 560
Top annotation and arrow

The annotation and arrow needs to be moved up so that it points to the "generated" in the body text.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 562
Body text under the heading

"TextView" and "android:text" in the first paragraph, and "String" and "TextView" in the second, need to be in code format.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 574
The code in the project build.gradle section

Change the line:
ext.room_version = "2.3.0"
to
ext.room_version = "2.4.1"

The latest version of Android Studio produces errors if you use the 2.3.0 version of the Room library. Using version 2.4.1 fixes this.

Dawn Griffiths
Dawn Griffiths
 
Jan 15, 2022  Jan 21, 2022
Printed
Page 581
NDQs

Part of the border underneath the "there are no dumb questions" heading is displayed, and shouldn't be. This can probably be corrected by making the border taller.

Dawn Griffiths
Dawn Griffiths
 
Dec 10, 2021  Jan 21, 2022
Printed
Page 590
Bottom annotation

The annotation needs to be moved up so that it lines up with the arrows better.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 617/618
The boxes behind the candidates and possible result values

The boxes are too pale in the printed book, and need to be a little darker.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 618
The entire page

Is it possible to swap pages 618 and 619? The solution to the exercise on page 617 is showing through the page, which makes it a little less challenging!

If this change happens, the index will also need to be updated.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 684
Bottom-left thought bubble.

The full-stop's missing from the end of the thought bubble text.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 711
Body text underneath the second heading

The body text is positioned a bit too low relative to the heading, and should be moved up so it reflects the rest of the book. See page 725 as an example.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 725
"Update the project build.gradle file…" section

In the line of code starting with "classpath", replace "plug-in" with "plugin".

Dawn Griffiths
Dawn Griffiths
 
Jan 06, 2022  Jan 21, 2022
Printed
Page 815
The top section

In order for the code in this chapter to work with the latest version of Android Studio, you need to downgrade the Kotlin Gradle plug-in to 1.5.21 in the project's build.gradle file.

To allow for this, the page needs to be updated as follows:

1. Under the "Update the project build.gradle file…" heading, change the body text to "We’ll begin by specifying which version of Compose to use. Open the file GuessingGame/build.gradle, and add the lines below (in bold) to the appropriate sections:"

2. Update the code in the "Update the project build.gradle file…" section to:
buildscript {
ext.compose_version = "1.0.1"
}
dependencies {
...
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
}
The "1.5.21" in this code should be bold, and there needs to be an annotation pointing to it that says "Use this version of the Kotlin Gradle plug-in."

Dawn Griffiths
Dawn Griffiths
 
Jan 15, 2022  Jan 21, 2022
Printed
Page 825
Bottom annotation

In the annotation, "activity" and "fragment" have been underlined. They should be highlighted using a darker shade instead, as this is the style used in the rest of the book. See page 2 as an example.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022
Printed
Page 852
Top annotation

Make the text box wider so the annotation text isn't crashing into the code.

Dawn Griffiths
Dawn Griffiths
 
Jan 13, 2022  Jan 21, 2022