Errata

Programming Android with Kotlin

Errata for Programming Android with Kotlin

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 Page 91
First three code examples

The first code example is in Kotlin since there are no semicolons, but the second and third code example is in Java since it has the `new` keyword and semicolons. I believe this two code examples should also be in Kotlin.

Note from the Author or Editor:
The code samples should indeed be in Kotlin.

Ryan Miles  Aug 30, 2022 
Page p. 48
1st and 2nd paragraphs

"PointAndAttr" should be "PointWithAttr" to match the code

Note from the Author or Editor:
"PointAndAttr" should be "PointWithAttr" in 1st and 2nd paragraphs.

David Beaulieu  Jan 23, 2023 
Page p. 163
last paragraph

"A HandlerThread completes when you invoke its quit or quickSafely method."

quickSafely should instead be named quitSafely.

Note from the Author or Editor:
The sentence "A HandlerThread completes when you invoke its quit or quickSafely method" should read: "A HandlerThread completes when you invoke its quit or quitSafely method".

David Beaulieu  Jan 23, 2023 
Page p. 257
3rd paragraph

The paragraph that starts: "The output is: Received 0" should instead read "The output is: Received 1"

Note from the Author or Editor:
The paragraph that starts: "The output is: Received 0" should instead read "The output is: Received 1"

David Beaulieu  Jan 23, 2023 
Page pp. 312, 313
Figure 12-1 vs. Figure 12-2

3rd paragraph on p. 312 states "Figure 12-2 shows a bird's-eye view of the very same layout hierarchy provided in the Component Tree."

However, the component tree in Figure 12-1 seems different from the diagram in Figure 12-2. For instance, it appears that FrameLayout should be a child of LinearLayout, not of DecorView. Also, ViewStub should be a child of LinearLayout, not of FrameLayout.

Note from the Author or Editor:
This sentence should indeed be rephrased as Figure 12-2 doesn't show exactly the same view hierarchy as in Figure 12-1.

David Beaulieu  Jan 23, 2023 
Page 37
The boolean function

val isAnyOdd = nums.any { it % 1 > 0 } // true

should be:

val isAnyOdd = nums.any { it % 2 > 0 } // true

Note from the Author or Editor:
val isAnyOdd = nums.any { it % 1 > 0 } // true

should be:

val isAnyOdd = nums.any { it % 2 > 0 } // true

Ossama Ahmad  Dec 18, 2022 
Page 105
3rd Code Example

The code block is written as var list: List<Int> = CopyOnWriteArrayList(listOf(1)). It should be written as var list: MutableList<Int> = CopyOnWriteArrayList(listOf(1)).

The List interface in Kotlin is designed to be immutable, so it doesn't contain the add or set methods, so in order to use them the list must be declared with a static type of MutableList<Int> instead of List<Int> in order for it to work with the above code blocks that called list.add(...).

Note from the Author or Editor:
"var list: List<Int> = CopyOnWriteArrayList(listOf(1))"

should read:

"var list: MutableList<Int> = CopyOnWriteArrayList(listOf(1))"

Ryan Miles  Aug 31, 2022 
Page 106
3rd paragraph

On page 106, before the second code example, the line reads "It ay help to see the Java equivalent:"

There is a typo. It should instead read, "It may help..."

Note from the Author or Editor:
Replace the sentence:
"It ay help to see the Java equivalent:"
by:
"It may help to see the Java equivalent:"

Anonymous  Mar 26, 2022  May 27, 2022
Page 134
3rd paragraph

On page 134 in the 3rd paragraph, the book reads: "The preceding program delays the slow async job delays it by 1,000 ms..."

I think that the word "delays" was incorrectly used twice and, instead the sentence should read: "The preceding program delays the slow async job by 1,000 ms..."

Note from the Author or Editor:
On page 134 in the 3rd paragraph, the book reads: "The preceding program delays the slow async job delays it by 1,000 ms..."

The word "delays" was incorrectly used twice and, instead the sentence should read: "The preceding program delays the slow async job by 1,000 ms..."

Jean Tadebois  Mar 27, 2022  May 27, 2022
Page 138
3rd paragraph

On page 138, the 3rd paragraph reads: "Both CoroutineScopes and CoroutineContexts play the role of the parent in previous illustrations, while Coroutines, on play the role of the children."

I believe that the sentence was meant to end as: "while Coroutines, on the other hand, play the role of the children."

Note from the Author or Editor:
On page 138, the 3rd paragraph reads: "Both CoroutineScopes and CoroutineContexts play the role of the parent in previous illustrations, while Coroutines, on play the role of the children."

The sentence was meant to end as: "Both CoroutineScopes and CoroutineContexts play the role of the parent in previous illustrations, while Coroutines, on the other hand, play the role of the children."

Anonymous  Mar 27, 2022