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
Printed
Page xi
Left side of page

The arrow on the far left has gone astray. It needs to be moved down so it's in between "This is our list view" and the ListView.

Dawn Griffiths
Dawn Griffiths
 
Jul 20, 2015  Jul 24, 2015
Printed
Page xv
Diagram on the left

The white arrow on the right of the diagram should be removed. The dark arrow at the top should have a white background.

Dawn Griffiths
Dawn Griffiths
 
Jul 20, 2015  Jul 24, 2015
Printed
Page xvi
Thought bubble on left

Move the circles onder the thought bubble down and to the right slightly so they connect the thought bubble to the butler's head.

Dawn Griffiths
Dawn Griffiths
 
Jul 20, 2015  Jul 24, 2015
PDF
Chapter 9, Bits And Pizzas App, The menu showAsAction attribute

when i run the source code of BitsAndPizzas app which i downloaded from your site and it was as described for the attribute: (app.showAsAction), i run it on 2 devices (API 17 & API 22) it didn't show the menu icons in the Action Bar, but when i changed the attribute to (android:showAsAction) it worked as expected and show the menu icons in the Action Bar, in both cases the library (com.android.support:appcompat-v7:21.1.2) exists in the app dependencies.

Note from the Author or Editor:
If you're using activities that extend Activity or one of its subclasses, prefix showAsAction with android:. If your activities extend AppCompatActivity, ActionBarActivity or one of its subclasses, prefix showAsAction with app:.

Anonymous  Jul 30, 2015  Aug 21, 2015
PDF
Page xxx
The examples are designed for learning.

Wording error:
We won’t complete every part of every app, but feel free to experiment finish them off yourself.

Possible correction:
We won’t complete every part of every app, but feel free to experiment and finish them off yourself.

Anonymous  Jul 31, 2016 
ePub
Page n/a

Throughout the ePub (as viewed on Safari), Blank Activity should be replaced by Empty Activity. I see from the errata that this has been corrected in the printed book

Note from the Author or Editor:
ePub version of the book needs to be updated to include the latest changes.

Ellen Spertus  Jan 05, 2017 
ePub

In Chapter 2, a spurious percent sign (%) appears in the sentence "It includes properties controlling its position, size, appearance, %and what methods it should call in the activity."

Note from the Author or Editor:
The spurious % needs to be removed

Ellen Spertus  Jan 05, 2017 
ePub

In Chapter 2, you write: "Replace your activity_find_beer.xml code with the following:..." The following code is an image and cannot be copied and pasted into the editor; nor is it in the source file that can be downloaded from your site, which has the final version of activity_find_beer.xml. It would be useful for readers if they could copy the code. (I would have tagged this as an enhancement request, if that option were available to me.)

Ellen Spertus  Jan 05, 2017 
3rd paragraph

Chapter 5
You specify a relative layout using <LinearLayout>. It should say you specify a linear layout using <LinerLayout>

Anonymous  Apr 15, 2015  Jun 09, 2015
3rd paragraph

Chapter 5 GridLayout section

You specify a relative layout using. Should say, you specify a GridLayout by using <GridLayout>

Anonymous  Apr 15, 2015  Jun 09, 2015
PDF
Page 3
United States

In "Linux Kernel" portion of graphic on this page, "Audio Drivers" says "Audiio Drivers" (extra 'i' in Audio)

Bill Rouck  Sep 14, 2015  Jan 22, 2016
PDF
Page 3
1st paragraph

Missing word:
It includes core applications such as Contacts, a set of APIs to help you control what your app looks and how it behaves, and a whole load of supporting files and libraries.

Possible correction:
It includes core applications such as Contacts, a set of APIs to help you control what your app looks like and how it behaves, and a whole load of supporting files and libraries.

Anonymous  Jan 09, 2016  Jan 22, 2016
PDF
Page 3
First paragraph

In the first paragraph on page 3, the paragraph ends without the sentence being completed.

"The Android platform is made up of a number of
different components. It includes core applications
such as contacts, a set of APIs to help you control what
your app looks and behaves like, and a whole load of ..."

Anonymous  Mar 06, 2015  Jun 09, 2015
PDF
Page 4
United States

Grammar - On page 4 in the questions area, "You really need experience of Java
SE" should read "You really need experience with Java SE"

Issue two with this, I searched in the PDF and the "SE" of "Java SE" does not appear to be defined as Standard Edition before that point in the document. SE isn't even spelled out in the table of contents, where JRE, JDK and JVM are.

Note from the Author or Editor:
Answer for second NDQ. Change the first sentence of the answer to "You need experience with Java SE (Standard Edition)."

William Rouck  Sep 14, 2015  Jan 22, 2016
PDF
Page 6
Caption

The code the design editor adds depends on where you plave the button

Anonymous  Mar 17, 2015  Jun 09, 2015
PDF
Page 6
First paragraph

Chapter 2 Page 6
Incomplete Sentence - "If you switch to the code editor, and you'll see that adding the"

Anonymous  Mar 17, 2015  Jun 09, 2015
PDF
Page 8
First paragraph

Chapter 2 Page 8
Missing word - "Should be displayed to each other"

Anonymous  Mar 17, 2015  Jun 09, 2015
PDF
Page 11
United States

- text " “friendly” name that may " not at same indentation as rest of text in that area of the page
- text " 4.0.3-4.0.4 " - other occurrences of ranged version numbers have a space before and after the hyphen

Note from the Author or Editor:
Change the formatting for 4.0.3-4.0.4 in the first column of the table so that it matches the others.

Also, please move the table and its annotations down a few notches so that it's centered vertically in the available space.

Bill Rouck  Sep 14, 2015  Jan 22, 2016
PDF
Page 11
First paragraph

An activity an a layout

Anonymous  Mar 17, 2015  Jun 09, 2015
PDF
Page 11
Point 7

'Which the learner' should be 'Which the user'

Anonymous  Mar 17, 2015  Jun 09, 2015
Printed
Page 13
Last line of body text, also the annotation

Change Blank Activity to Empty Activity to fit in with changes made to Android Studio since the book was written.

The screenshot also needs to be changed to reflect the type of activity we need to choose.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
Printed
Page 14
Annotation

Change "Accept the defaults" to "Accept any other defaults"

Note that if you choose Empty Activity, this screenshot will look different, and won't include as many default options.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
PDF
Page 16
Page title

Missing space in page title (which causes the title to display incorrectly in the PDF outline):
Android Studio createsa complete folder structure for you

Possible correction:
Android Studio creates a complete folder structure for you

Anonymous  Jul 31, 2016 
PDF
Page 16
Header

The words 'The code editor' overlaps with paragraph 1

Anonymous  Mar 17, 2015  Jun 09, 2015
PDF
Page 23
2nd paragraph

Wrong word:
But what if you don’t have one to hand, or you want to see how it looks on a type of device you don’t have?

Possible correction:
But what if you don’t have one on hand, or you want to see how it looks on a type of device you don’t have?

Note from the Author or Editor:
Replace "to hand" with "with you"

Anonymous  Jan 09, 2016  Jan 22, 2016
PDF
Page 30
First paragraph

Incomplete sentence: 'Here's the code from acivity_manin.xml that Android'

Anonymous  Mar 17, 2015  Jun 09, 2015
PDF
Page 31
f

'Element is the last one' should be 'Element is the first one'

Anonymous  Mar 17, 2015  Jun 09, 2015
PDF
Page 32
Last paragraph

Grammatical error:
Let’s take a closer look at.

Possible correction:
Let’s take a closer look.

Note from the Author or Editor:
The last sentence should be "Let's take a closer look at it"

Anonymous  Jan 09, 2016  Jan 22, 2016
PDF
Page 33

It seems that since API 23 Android uses CoordinatorLayout and activity_main has been split into activity_main.xml and content_main.xml and consequently all the details referred to on this page are now in content_main.xml.

Note from the Author or Editor:
This is due to a change to Android Studio after the book was written. Instead of choosing "Blank Activity" when you create a new project, choose "Empty Activity" instead.

Anonymous  Nov 24, 2015  Jan 22, 2016
PDF
Page 34
Paragraph 1

Missing underscore:
But why does it say “@string/hello world” rather than “Hello world!”?

Possible correction:
But why does it say “@string/hello_world” rather than “Hello world!”?

Anonymous  Jul 31, 2016 
PDF
Page 35
Bullet point 1 on the right

AndroidManafest.xml instead of AndroidManifest.xml

Anonymous  Mar 17, 2015  Jun 09, 2015
PDF
Page 38
Left-side bullet list

5th bullet, "you app" should be "your app"

Bill Rouck  Sep 16, 2015  Jan 22, 2016
Printed
Page 40
Top screenshot

The annotations and arrows on the screenshot need moving to the left so they're not covering the button and list.

Dawn Griffiths
Dawn Griffiths
 
Aug 14, 2015  Aug 21, 2015
Printed
Page 42
Step 4

Change "a blank activity" to "an empty activity" to fit in with changes made to Android Studio since the book was written.

Add "if prompted" after "Menu Resource Name".

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
PDF
Page 45
First paragraph after first code listing

A percent sign is in the paragraph text, should be removed. "It includes properties controlling its position, size, appearance, %and what methods it should call in the activity"

Bill Rouck  Sep 16, 2015  Jan 22, 2016
PDF
Page 45
Last paragraph

It seems that something is missing here:

"As an example, the XML above specifies that ______. An
equivalent statement would be to say that ______."

Diego Thoms  Mar 24, 2015  Jun 09, 2015
PDF
Page 51

As noted in an earlier error, it seems that since API 23 Android uses CoordinatorLayout and activity_main has been split into activity_main.xml and content_main.xml and consequently all the details referred to on this page are now in content_find_beer.xml.

Note from the Author or Editor:
This is due to a change to Android Studio after the book was written. Instead of choosing "Blank Activity" when you create a new project, choose "Empty Activity" instead.

Anonymous  Nov 24, 2015  Jan 22, 2016
PDF
Page 65
Q: Why did we replace the activity code that Android Studio created for us?

Redundant phrasing:
A: IDEs such as Android Studio include lots of time-saving functions and utilities that can save you a lot of time.

Possible correction:
A: IDEs such as Android Studio include lots of functions and utilities that can save you a lot of t

Note from the Author or Editor:
The first sentence of the final answer should be "IDEs such as Android Studio include functions and utilities that can save you a lot of time."

Anonymous  Aug 02, 2016 
PDF
Page 67
First paragraph

It says... "In version two of the servlet..."

¿Servlet? Wrong book :)

Diego Thoms  Mar 24, 2015  Jun 09, 2015
Printed
Page 75
First paragraph under Create the project

Change "a blank activity" to "an empty activity" to fit in with changes made to Android Studio since the book was written.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
Printed
Page 78
2nd paragraph

Change "Blank Activity" to "Empty Activity" to fit in with changes made to Android Studio since the book was written.

The screenshot will also look different.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
Printed, ePub
Page 84
Bullet point 1

A comma is missing in "the main activity, CreateMessageActivity starts". It should be "the main activity, CreateMessageActivity, starts".

Ellen Spertus  Jan 06, 2017 
Printed, ePub
Page 85
Last screen

"Hello world!" is not displayed for me. It was not generated as part of an Empty Activity.

Note from the Author or Editor:
Android Studio no longer adds the default text.

p85: Add the following text to the end of the final annotation: "Don't worry if your layout looks different to ours."

p86: Change the annotation towards the bottom of the page to say "Here's the text view that currently appears in our layout."

p87: Add an annotation pointing to the line of code <TextView that says "You'll need to add this TextView yourself if Android Studio hasn't already added it for you."

Ellen Spertus  Jan 06, 2017 
PDF
Page 86
1st Paragraph, Bullet #2

Says "Update CreateMessageActivity.xml" instead of "Update CreateMessageActivity.java"

Lynn Samson  Aug 15, 2015  Aug 21, 2015
PDF
Page 96
Title

"Create an intent that specifies an"

Missing " Action" at the end.

Diego Thoms  Mar 25, 2015  Jun 09, 2015
ePub
Page 118
final paragraph

The package named "com.hfad.stopwatch" is misspaced as "com.hfad. stopwatch" in the Safari ebook.

Ellen Spertus  Jan 07, 2017 
PDF
Page 120
Last paragraph

Missing word:
These values are String resources, so need to be added to strings.xml.

Possible correction:
These values are String resources, so they need to be added to strings.xml.

Anonymous  Jan 27, 2016 
PDF
Page 121
Paragraph 1

Subject/Verb agreement:
We’ll use these method to start, stop, and reset the stopwatch.

Possible correction:
We’ll use these methods to start, stop, and reset the stopwatch.

Anonymous  Aug 14, 2016 
PDF
Page 124
Last paragraph

Missing word:
The postDelayed() method works in a similar way to the post() method except that you use it post code that should be run in the future.

Possible correction:
The postDelayed() method works in a similar way to the post() method except that you use it to post code that should be run in the future.

Anonymous  Jan 27, 2016 
Printed
Page 124
First "handwritten" comment

I think it should say"Runnable's" instead of "Handler's" where it says "<--You put the code you want to run in the Handler's run() method."

Daniel Jacobson  Nov 27, 2016 
PDF
Page 128
2nd Paragraph, last sentence.

Missing word in "and at the <b> end</b> of its life,"

Diego Thoms  Mar 27, 2015  Jun 09, 2015
PDF
Page 130
Drawing, Activity class

onCreate(Bundle) repeated

Diego Thoms  Mar 27, 2015  Jun 09, 2015
PDF
Page 141
Last "A:"

The code font PLUS Camel Case capitalization PLUS dot-notation make this statement very difficult to parse. (Look at the original text since the code font won't appear in this form.):
No, but it’s designed to work like a java.util.Map. Bundles have additional abilities to maps, for example, Bundles have the ability to be sent between processes.

Possible correction:
No, but it’s designed to work like a java.util.Map. For example, Bundles have additional capabilities, such as the ability to be sent between processes.

Note from the Author or Editor:
For the final NDQ answer, change the sentence that says "Bundles have additional abilities compared to Maps, for example, Bundles can be sent between processes" to "A Bundle has additional abilities compared to a Map. Bundles can be sent between processes, for example."

Anonymous  Aug 14, 2016 
PDF
Page 142
Paragraph 1

Missing space:
So far we’ve looked at the create and destroy parts of the activity lifecycle,and you’ve seen...

Possible correction:
So far we’ve looked at the create and destroy parts of the activity lifecycle, and you’ve seen...

Anonymous  Aug 14, 2016 
Printed
Page 147
Main heading

Should say "StopwatchActivity", not "StopwathActivity"

Dawn Griffiths
Dawn Griffiths
 
Jul 16, 2015  Jul 24, 2015
Printed
Page 156
Bottom of page

"There are no Dumb Questions" passage, first question. Seems
"onPause()" method is mixed with the "onDestroy()":

Printed: "In certain circumstances, Android may choose not to call methods like onStop() and onPause()."

Should be: "In certain circumstances, Android may choose not to call
methods like onStop() and onDestroy()."

Reference:
http://developer.android.com/reference/android/app/Activity.html,
http://developer.android.com/guide/components/activities.html

Anonymous  Apr 11, 2016 
PDF
Page 170
the <Button> code

the Second Button's @+id/button_click_me should be @id/button_click_me
because it only refers to the defined First Button

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button_click_me"
android:layout_below="@+id/button_click_me"
android:text="@string/new_button_text" />

should be

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/button_click_me"
android:layout_below="@id/button_click_me"
android:text="@string/new_button_text" />

Note from the Author or Editor:
Change the third paragraph to: The syntax "@+id" tells Android to include the ID as a resource in its resource file R.java. You must include the "+" whenever you define a new view in the layout. If you don't, Android won't add the ID as a resource and you'll get errors in your code.

Add an annotation that points to the two lines of code at the bottom of the page that says: When you're referring to views that have already been defined in the layout, you can use @id instead of @+id.

Chen Dong  Aug 23, 2015  Jan 22, 2016
PDF
Page 170
Third paragraph

Wrong word?:
If you miss out the "+", Android won’t add the ID as a resource and you’ll get errors in your code.

Possible correction:
If you leave out the "+", Android won’t add the ID as a resource and you’ll get errors in your code.

Anonymous  Jan 28, 2016 
PDF, ePub
Page 183
3rd paragraph

The text:
'Many attributes, however, are specific to one
particular type of attribute.'

Should probably be:
'Many attributes, however, are specific to one
particular type of layout.'

Iwan Nijs - de Boer  Mar 08, 2016 
PDF
Page 202
First object diagram

Arrow overlaps the corresponding text:
Spinners are a more complex type of View.

Anonymous  Jan 28, 2016 
PDF
Page 203
Last paragraph

Confusing wording:
As a view group is also a type of view, this means that all layouts and GUI components share this common functionality.

Possible correction:
Since a view group is also a type of view, all layouts and GUI components share this common functionality.

Anonymous  Jan 28, 2016 
PDF
Page 208
Toggle button example code

Example method names don't match:

android:onClick="onToggleButtonClicked"

public void onToggleClicked(View view) {...

Note from the Author or Editor:
In the code at the bottom of the page, change onToggleClicked to onToggleButtonClicked

Anonymous  Aug 15, 2016 
Printed
Page 212
The code section under "Using them in your activity code"

The line of code:

RadioGroup radioGroup = findViewById(R.id.radioGroup);

should be:

RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup);

Dawn Griffiths
Dawn Griffiths
 
Jul 19, 2015  Jul 24, 2015
Printed
Page 213
Code section at the bottom of the page

The line of code:

RadioGroup radioGroup = findViewById(R.id.radioGroup);

should be:

RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radioGroup);

Dawn Griffiths
Dawn Griffiths
 
Jul 19, 2015  Jul 24, 2015
PDF
Page 218
Defining it in XML

Missing closing quotation mark:
android:src="@drawable/button_icon />

Correction:
android:src="@drawable/button_icon" />

Anonymous  Aug 15, 2016 
PDF
Page 232
Block "The top level activity"

Second block of paragraphs, first paragraph:

"When the learner clicks on an item in the list,
the app uses their selection to navigate to a
separate activity."

You might want to exchange "learner" for "user".

==> "When the user clicks on an item in the list..."

btw:
In this block's first paragraph, reading:

"When the user launches the app, the user will
be presented with the top level activity, the
main entry point of the app."

you might perhaps want (or maybe not) to exchange the second "user" for "he" or "she".

Anonymous  May 14, 2015  Jun 09, 2015
Printed
Page 237
2nd paragraph

Change https://tinyurl.com/HeadFirstAndroid to http://tinyurl.com/HeadFirstAndroidCoffeeImages.

Change "drag the file" to "drag each file"

Dawn Griffiths
Dawn Griffiths
 
Sep 15, 2015  Jan 22, 2016
PDF
Page 244
Last "A:"

The code font meant for "CheckBox" in the word "CheckBoxes" extends to include the adjoining e so that "CheckBoxe" is in code font.

Anonymous  Aug 16, 2016 
Printed
Page 257
2nd annotation

The annotation is partly covered by an arrow, so needs moving to the right.

Dawn Griffiths
Dawn Griffiths
 
Jan 30, 2016 
Printed
Page 270
Bottom screenshot

Move the horizontal arrow a few spaces to the left so it's closer to the left Limb Loosener.

Dawn Griffiths
Dawn Griffiths
 
Aug 14, 2015  Aug 21, 2015
Printed
Page 274
Last paragraph

Change "a blank activity" to "an empty activity". This is to fit in with changes made to Android Studio since the book was written.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
PDF
Page 275
Section "The Workout class", image comment on the static Workout[] array

The comment on the static array "workouts" reads:

"workouts is an array of three Workouts"

but in an effort to enhance our fitness, you created an additional 4th exercise. Thus, the comment should read:

"workouts is an array of four Workouts"

;-)

Anonymous  May 23, 2015  Jun 09, 2015
Printed
Page 276
Top annotation

Move the top annotation and its arrow up a line so it's pointing to the word "extra".

Dawn Griffiths
Dawn Griffiths
 
Sep 15, 2015  Jan 22, 2016
PDF
Page 280
Section "Passing the workout id to the fragment", 2nd block of paragraphs, 4th paragraph

Whoa! Your Workout class is the REAL thing - it's got an IT department of it's own - or did you just mean "id" instead of "it"?

"Later on we’ll use the workout it to update the fragment’s views."

;-)

Anonymous  May 23, 2015  Jun 09, 2015
Printed
Page 281
Top annotation

Expand the frame of the anno to the right so that the word "layout" moves up to the next line and doesn't overcrowd the line of code.

Dawn Griffiths
Dawn Griffiths
 
Aug 14, 2015  Aug 21, 2015
PDF
Page 281
Section "Get the activity to set the workoutId", 2nd-to-last block of paragraphs, 1st paragraph

Missing "the":

The paragraph currently reads:

"We’re using the code frag.setWorkout(1) to tell fragment which
workout we want it to display details of. "

Should probably read:

"...to tell the fragment... "

Anonymous  May 23, 2015  Jul 24, 2015
PDF
Page 286
"What happens when you run the app", item #2 and #3 (images)

The 2nd step description says (correctly):

"MainActivity passes the workout id to WorkoutDetailFragment in its
onCreate() method by calling the fragment’s setWorkout() method.", the relating images, however, are captioned with "WorkoutListFragment".java
instead of "WorkoutDetailFragment.java"

Note from the Author or Editor:
Under "what happens when you run the app", relabel the two triangle images from "WorkoutListFragment" to "WorkoutDetailFragment".

Anonymous  May 18, 2015  Jul 24, 2015
PDF
Page 287
1st Paragraph

The second sentence states: "MainActivity uses WorkoutListFragment to display details of the workout, and ..." It should say: "MainActivity uses WorkoutDetailFragment to display details of the workout, and ..."

Anonymous  Jul 07, 2016 
PDF
Page 289
Paragraph 2

Duplicate word:
Just as with a list activity, there are are a couple...

Correction:
Just as with a list activity, there are a couple...

Anonymous  Aug 24, 2016 
PDF
Page 289
First paragraph after the section title

Missing "a" in the first paragraph starting with:

"A list fragment is type of fragment that..."

should probably read:

"A list fragment is a type of fragment that..."

Anonymous  May 18, 2015  Jul 24, 2015
PDF
Page 289
Sidebar notes, lower right corner

The first paragraph in that sidebar reads:

"A ListFragment is a type of Fragment that’s specializes in working with a ListView."

==> should probably read

"...a type of Fragment that specializes..."

Anonymous  May 18, 2015  Jul 24, 2015
PDF
Page 294
First paragraph after the section title "Test drive the app"

The first paragraph after the section title currently reads:

"When we run the app, a list of the workouts appears in a list on the left of the screen, and details of a single workout appears on the
right."

==> probably should read:

"...and details of a single workout appear on the
right."

Anonymous  May 18, 2015  Jul 24, 2015
PDF
Page 294
Image of app structure

Regarding the "fragment_workout_list.xml" file:

On pg. 290, "How to create a list fragment", first block of paragraphs, you mentioned that we won't create an XML layout file for the list fragment on our own, because:

"Give the fragment a name of “WorkoutListFragment”, and then untick the options to create layout XML, and also the options to include fragment factory methods and interface callbacks. List fragments define their own layouts programatically, so you don’t need Android Studio to create one for you."

So you might want to mention within the image showing the app structure that the layout for the list fragment will be auto-defined by android.

Anonymous  May 18, 2015  Jul 24, 2015
Printed
Page 297
Before the onAttach() method

The second @Override annotation is slightly misindented.

Note from the Author or Editor:
An extra space needs to be added before the second @Override

Ellen Spertus  Feb 08, 2017 
PDF
Page 300
Section "Don't update - replace", first block of paragraphs, 2nd paragraph

The paragraph reads:

"That way, we can store the fragment replacement inside a back stack transaction, and the user will be unable to undo the change by hitting the back button."

==> should read:

"...and the user will be able to undo the change..."

Note from the Author or Editor:
First paragraph "will be unable to undo the change" should be "will be able to undo the change".

Anonymous  May 19, 2015  Jul 24, 2015
Printed
Page 304, 305

If you rotate the device more than once and hit the back button, the workoutId still loses its current value. Instead of retrieving the current value in the onCreateView() method, retrieve it in the fragment's onCreate() method instead. The full code is available here: https://github.com/dogriffiths/HeadFirstAndroid/blob/master/chapter07/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java

Dawn Griffiths
Dawn Griffiths
 
Jan 01, 2016  Jan 22, 2016
Printed
Page 310
BE the Folder Structure question

The question provided on page 310 does not match the question answered on page 312.

Page 310: "... and another layout when it runs on devices with normal sized screens."

Page 312: "... and another layout when it runs on devices with smaller sized screens."

This changes whether option E is a correct or incorrect structure.

Note from the Author or Editor:
On page 310 change the exercise instructions. Replace "normal sized screens" with "smaller sized screens"

Andrew Covington  Jan 03, 2017 
Printed
Page 316
2nd paragraph

Change "blank activity" to "empty activity". This is to fit in with changes made to Android Studio since the book was written.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
PDF
Page 317
text next to pool

"These code snippets were not needed here" is shown on both the question page and the solution page, when presumably it should only be shown on the solution page.

Note from the Author or Editor:
Remove the annotation and arrow on page 317 that says "These code snippets were not needed here"

Anonymous  Aug 29, 2015  Jan 22, 2016
327
Table

All of the check marks are missing from the table, at least when the Safari book is viewed in Chrome on a Windows 10 box.

Ellen Spertus  Feb 15, 2017 
PDF
Page 327
First block of paragraphs after the section title, 2nd paragraph

The paragraph currently reads:

" If we looks at the lifecycles of fragments and activities, we’ll see that they’re very similar:"

==> should read:

" If we look at the lifecycles..."

Anonymous  May 22, 2015  Jul 24, 2015
PDF
Page 332
4th paragraph

Missing word: "to"

The 4th paragraph currently reads:

"Give the fragment a name of “StopwatchFragment”, a layout name of “fragment_stopwatch”, and untick the options include fragment factory methods and interface callbacks."

==> should read:

"...and untick the options to include..."

Anonymous  May 22, 2015  Jun 09, 2015
PDF
Page 340
Section title

Misspelled word:
getFragmentManager() creates transactions at the activity lavel

Correction:
getFragmentManager() creates transactions at the activity level

Anonymous  Aug 28, 2016 
Printed
Page 342, 343, 357, 358

Instead of adding the fragment transaction to the onCreateView() method, we need to add it to the fragment's onCreate() method instead. This fixes a bug you get when you rotate the device multiple times and hit the back button. The full code is available here: https://github.com/dogriffiths/HeadFirstAndroid/blob/master/chapter08/Workout/app/src/main/java/com/hfad/workout/WorkoutDetailFragment.java

Dawn Griffiths
Dawn Griffiths
 
Jan 01, 2016  Jan 22, 2016
Printed,
Page 345
Top of stack trace

Stack trace shows package com.hfad.fraghack, but code on p. 332 shows package com.hfad.workout.

Note from the Author or Editor:
Change all instances of "fraghack" on this page to "workout"

Ellen Spertus  Feb 15, 2017 
Printed,
Page 347
Point 2

"onClickListener" should be "OnClickListener" (upper camel case).

Ellen Spertus  Feb 15, 2017 
PDF
Page 349
Paragraph 2

Wording error:
This turns StopwatchFragment into a type of View.OnClickListener so that it can respond to when views are clicked.

Correction:
This turns StopwatchFragment into a type of View.OnClickListener so that it can respond when views are clicked.

Anonymous  Sep 19, 2016 
PDF
Page 349
Section "Make the fragment implement OnClickListener", 2nd block of paragraphs

Just a minor text layout issue:

In the paragraph:

"This turns StopwatchFragment into a type of View.
OnClickListener. so that it can respond to when views are clicked."

it would be nice to have "View.OnClickListener" on the same line and the dot currently following "View.OnClickListener. " removed.

Anonymous  May 22, 2015  Jul 24, 2015
Printed,
Page 352
1st statement in onCreateView()

"R.layout.stopwatch" should be "R.layout.fragment_stopwatch".

Note from the Author or Editor:
Update the code on pages 351 and 352 to change R.layout.stopwatch to R.layout.fragment_stopwatch

Ellen Spertus  Feb 22, 2017 
PDF
Page 366
PDF bookmarks

The PDF bookmarks for Chapter 9 include the headings of the detail screens (Pizzas, Stores, Pasta, Pizzas, Cambridge, etc) as well as one for "android:id" (which just goes to one of the entries in the table on page 377).

Anonymous  Aug 29, 2015  Jan 22, 2016
PDF
Page 368
2nd bullet point

"The action bar has a number of uses":

2nd bullet point:

"For making key actions prominant in a way..."

should read:

"... prominent in a way..."

Anonymous  May 24, 2015  Jun 09, 2015
Printed
Page 370
1st paragraph

Change "a blank activity" to "an empty activity". This is to fit in with changes made to Android Studio since the book was written.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
Printed,
Page 370
Paragraph 1

When an empty (blank) activity is created, the user is not prompted for a menu resource.

Note from the Author or Editor:
Android Studio no longer creates the menu resource file for you, so you need to add it yourself on page 377.

To create the menu resource file, select the app/src/main/res folder, go to the File menu, and choose New. Then choose the option to create a new Android resource file. You’ll be prompted for the name of the resource file and the type of resource. Give it a name of “menu_main”, a resource type of “Menu”, and make sure that the Directory name is “menu”. When you click on OK, Android Studio will create the file for you.

Ellen Spertus  Feb 22, 2017 
PDF
Page 373
Block of paragraphs left to the folder tree image, 3rd paragraph

Change "is" to "it":

"In our case, the style has a name of "AppTheme", so AndroidManifest.xml can refer to is using "@style/AppTheme".

should read:

"...AndroidManifest.xml can refer to it using..."

Anonymous  May 24, 2015  Jul 24, 2015
PDF
Page 374
5th paragraph

The paragraph currently reads:

"By default, we want to use a theme of Theme.Holo.Light, so make this needs to be reflected in the <style> attribute like this:"

Maybe eliminate the "make":

"...so this needs to be reflected..."

Anonymous  May 25, 2015  Jun 09, 2015
Printed
Page 375
2nd circled step

Current sentence: If the app's rnning on API level 21, it uses the style called AppTheme in the values-21 folder.

values-21 should be values-v21

Linda  Oct 16, 2015  Jan 22, 2016
PDF
Page 378
Paragraphs left to folder tree image, 3rd paragraph

Might want to exchange "attribute" for "element":

If your project has a dependency on the v7 appcompat library,
showAsAction must be prefixed with app:, and the <menu>
attribute must include an attribute of xmlns:app="http://schemas.android.com/apk/res-auto"

should read:

"... and the <menu>
element must include an attribute of ..."

Note from the Author or Editor:
Three quarters of the way down the page under "If your project has a dependency on the v7 appcompat library", <menu> attribute should be <menu> element.

Anonymous  May 25, 2015  Jul 24, 2015
PDF
Page 379
3rd paragraph

The instructions say to download the Android icon pack from https://developer.android.com/design/downloads/index.html, then copy ic_action_new_event icons from the icon pack's Action Bar Icons/holo_light/05_content_new_event folder into the project. It appears that the action pack has been replaced by the Material icon pack available on GitHub. There doesn't appear to be a "new event" icon in the new set.

Further, the instructions "Copy the icon in the drawable-hdpi folder to the drawable_hdpi folder in your project, and so on" aren't clear to me. Exactly which files do I need to copy?

Note from the Author or Editor:
The Android icon pack was replaced with the Material icon collection after the book was published. Replace paragraphs 2, 3 and 4 with the following:

When you use icons in your action bar, you can create your own or use icons from the Android action bar icon pack. The icon pack contains many standard icons you can use in your apps, and you can get it from https://developer.android.com/design/downloads/index.html.

We’re going to use an icon called ic_action_new_event, and we’ll use a different size icon for different screen densities. To use the icon, go to http://tinyurl.com/HeadFirstAndroidNewEventIcons, download
ic_action_new_event.jpg from the drawable-hdpi folder, and add it to the drawable-hdpi folder in your project. Then repeat this for the drawable-mdpi, drawable-xhdpi and drawable-xxhdpi folders.

Anonymous  Aug 29, 2015  Jan 22, 2016
Printed
Page 382
2nd paragraph

Change "blank activity" to "empty activity". This is to fit in with changes made to Android Studio since the book was written.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
Printed
Page 405
First Sentence

Sentence refers to changing the layout of the .java file rather than the .xml file.

Original: "Next, we'll change the layout of MainActivity.java so that...

Should be: Next, we'll change the layout of activity_main.xml so that...

Note from the Author or Editor:
The first sentence should be "Next, we'll change the layout for MainActivity so that it uses a DrawerLayout."

Andrew Covington  Jan 06, 2017 
Printed
Page 408
The code sample

There are unneeded semicolons at the ends of the two class definitions.

Note from the Author or Editor:
The two lines of code that say }; should be changed to }. This also affects pages 414, 419, 429 and 430

Ellen Spertus  Feb 22, 2017 
PDF
Page 418
1st paragraph

"If you have items on your action bar that are specific to the contents of a particular fragment, you may want to hide them when the drawer is open, and display them again when the drawer is open."

should be

"If you have items on your action bar that are specific to the contents of a particular fragment, you may want to hide them when the drawer is open, and display them again when the drawer is closed."

Chen Dong  Sep 16, 2015  Jan 22, 2016
PDF
Page 421
2nd paragraph

"...from within the activity's postCreate() method" the method is actually called onPostCreate (this is correct on the remainder of the page).

Anonymous  Aug 29, 2015  Jan 22, 2016
Printed
Page 432
2/3 of the way down

Where you see the bold "visible_fragment" in the code, add an annotation that says "Add a tag to the fragment." and add an arrow pointing from the anno to the code.

Dawn Griffiths
Dawn Griffiths
 
Aug 14, 2015  Aug 21, 2015
Printed
Page 432
Top of code

Add an annotation to the bold line of code currentPosition = position that says "Update the current position.". Add an arrow that goes from the anno to the line of code.

Dawn Griffiths
Dawn Griffiths
 
Aug 14, 2015  Aug 21, 2015
Printed
Page 438
Bottom


The last two paragraphs refer to the Starbuzz database, but shouldn't it be the Starbuzz app or program?

The app gets its data from the Drink class now, but will in the future get it from a database. I could be wrong, but ... it is referring to the past tense.

The sentence " ... we're going to change the Starbuzz database so that it gets its data from a SQLite database" is illogical.

Note from the Author or Editor:
Change "we're going to change the Starbuzz database" to "we're going to change the Starbuzz app"

Anonymous  Aug 06, 2015  Aug 21, 2015
PDF
Page 442
Diagram note

Missing word:
We’ll store drinks in a database rather the Drink class.

Correction:
We’ll store drinks in a database rather than the Drink class.

Anonymous  Oct 25, 2016 
PDF
Page 444
code

Page 444 gives us the initial code for StarbuzzDatabaseHelper. The code includes an empty constructor with one argument (Context). This will lead to an error in the IDE because the superclass SQLiteOpenHelper doesn't have a no-args constructor. We're being told how to fix this on the next page, but it would be nice to put a comment or annotation into the empty constructor on page 444 that tells us we'll be fixing the problem later.

Note from the Author or Editor:
Add an annotation that says "We'll write the code for the constructor on the next page" that points to the line of code "StarbuzzDatabaseHelper(Context context) {"

Anonymous  Aug 29, 2015  Jan 22, 2016
Printed
Page 446
first paragraph

"... like a number of a piece of text" should be "... like a number or a piece of text"

Anonymous  Mar 16, 2016 
PDF
Page 448
paragraphs 2, 3, 4

There three spots in these paragraphs where a class/method name is typeset in boldface montoype. All other in-text class/method names are typeset in normal weight monotype. If the boldface was chosen in these three spots for emphasis then it isn't clear from the text why they are emphasised.

Note from the Author or Editor:
Change the following so they're not emboldened:
SQLiteDatabase insert() in paragraph 2
ContentValues in paragraph 3
put() in paragraph 4

Anonymous  Aug 30, 2015  Jan 22, 2016
PDF
Page 490
Last line of code

Missing space:
null, null,null);

Correction:
null, null, null);

Note from the Author or Editor:
Instances of "null,null" in this chapter need to be replaced with "null, null".

Anonymous  Jan 23, 2017 
Printed
Page 507
3rd paragraph

"the users favorite drinks" should be "the user's favorite drinks".

Ellen Spertus  Mar 03, 2017 
PDF
Page 513
try block

The SQLDatabase from the onCreate() method doesn't require write access. Only the one in onFavoriteClicked(), therefore this line doesn't actually need to change and can remain as:
SQLiteDatabase db = starbuzzDatabaseHelper.getReadableDatabase();

Note from the Author or Editor:
Replace getWritableDatabase() with getReadableDatabase() and remove the annotation/arrow that's pointing to it.

Anonymous  Jul 09, 2016 
Printed
Page 517
1st sentence

"the users favorite drinks" should be "the user's favorite drinks".

Ellen Spertus  Mar 07, 2017 
PDF
Page 520
Code notes

Missing period:
Display a message if there’s a problem with the database

Correction:
Display a message if there’s a problem with the database.

Anonymous  Jan 24, 2017 
Printed
Page 524
middle of code example

@Override missing before onRestart().

Note from the Author or Editor:
@Override needs to be inserted just above the line that says public void onRestart() {

Ellen Spertus  Mar 07, 2017 
PDF
Page 525
Third bullet

Subject/verb agreement:
All of the other thread that you create

Correction:
All of the other threads that you create

Anonymous  Jan 25, 2017 
PDF
Page 528
Code notes

Wording error:
We must to run the code to update the views on the main thread, otherwise we get an exception.

Correction:
We must run the code to update the views on the main thread, otherwise we get an exception.

Anonymous  Jan 25, 2017 
PDF
Page 533
Paragraph 1

Missing word:
The onProgressUpdate() method is called on the main event thread, so has access to views in the user interface.

Correction:
The onProgressUpdate() method is called on the main event thread, so it has access to views in the user interface.

Anonymous  Jan 25, 2017 
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 534
First Paragraph

The following lone has error:
The onPreExecute() method is called after the background
task has finished.

Should be:
The onPostExecute() method is called after the background
task has finished.

All edition like pdf , book etc have this issue.

Note from the Author or Editor:
The first sentence should be "The onPostExecute() method is called after the background task has finished."

icewheel  Jul 19, 2015  Jul 24, 2015
Printed
Page 534
1st paragraph

In the first paragraph it mentions onPreExecute() instead of onPostExecute()

Note from the Author or Editor:
Change onPreExecute() in the first paragraph to onPostExecute().

Ben Davies  Aug 28, 2015  Jul 24, 2015
PDF
Page 534
Paragraph 1

Missing word:
It’s called on the main event thread, so has access to views in the user interface.

Correction:
It’s called on the main event thread, so it has access to views in the user interface.

Anonymous  Jan 25, 2017 
PDF
Page 534
Paragraph 1

Missing word:
The onPostExecute() method gets passed the results of the doInBackground() method, so must take parameters that match the doInBackground() return type.

Correction:
The onPostExecute() method gets passed the results of the doInBackground() method, so it must take parameters that match the doInBackground() return type.

Anonymous  Jan 25, 2017 
PDF
Page 534
Paragraph 2

Missing word:
the doInBackground() method runs in a background thread, so can’t update views.

Correction:
the doInBackground() method runs in a background thread, so it can’t update views.

Anonymous  Jan 25, 2017 
Printed
Page 535
middle of page

//Code that you wan to run when the task is complete
should be:
//Code that you want to run when the task is complete

want is missing the "t"

Anonymous  Apr 11, 2016 
Other Digital Version
537
Code example

In your source code at github [https://github.com/dogriffiths/HeadFirstAndroid/blob/master/chapter12/Starbuzz/app/src/main/java/com/hfad/starbuzz/DrinkActivity.java#L84], you are missing a line break between statements on line 84.

Note from the Author or Editor:
We've added a line break to the source code.

Ellen Spertus  Mar 08, 2017 
Printed
Page 539
Step 4 of AsynchTask summary

Slight typo in step 4 of AsynchTask steps where finished is spelt as "finsihed"

Note from the Author or Editor:
Change "finsihed" to "finished"

Ben Davies  Aug 28, 2015  Jan 22, 2016
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 561
5th Paragraph

Line is:

The notification service deals will all of the issues involved in a
background service sending updates to the screen.

Should Be: (will --> with )

The notification service deals with all of the issues involved in a
background service sending updates to the screen.

icewheel  Jul 20, 2015  Jul 24, 2015
Printed
Page 571
1st paragraph

Change "a blank activity" to "an empty activity". This is to fit in with changes made to Android Studio since the book was written.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
PDF
Page 576
Paragraph 3

Wording error:
This method has one parameter, a Location object that represents the device current location.

Correction:
This method has one parameter, a Location object that represents the device's current location.

Anonymous  Mar 15, 2017 
PDF
Page 579
Paragraph 5

Wording error:
The activity will call this method whenever it want to know the distance.

Correction:
The activity will call this method whenever it wants to know the distance.

Anonymous  Mar 15, 2017 
PDF
Page 581
the code paragraph

There's no LocationManager.removeUpdates() method to release the resource after the service stopped.

move the listener & locManager definition outside of the onCreate() method and override the onDestroy() method

@Override
public void onDestroy() {
if (listener != null) {
locManager.removeUpdates(listener);
listener = null
}
}

Note from the Author or Editor:
We've updated the code for OdometerService.java. The revised code is available here: https://github.com/dogriffiths/HeadFirstAndroid/blob/master/chapter13/Odometer/app/src/main/java/com/hfad/odometer/OdometerService.java

Chen Dong  Sep 21, 2015  Jan 22, 2016
PDF
Page 586
activity_main.xml TextView element textSize

android:textSize="60dp"

should be changed to

android:textSize="60sp"

As the book mentioned in Page 205, the text Size is suggested to use scale-independent pixels(sp).

Note from the Author or Editor:
Change the line
android:textSize="60dp"/>
to
android:textSize="50sp"/>

Mahone  Jan 03, 2016  Jan 22, 2016
Printed
Page 586
TextView xml code

"android:singleLine" is deprecated. False is the default so the attribute can be removed.

Andrew Covington  Jan 09, 2017 
Printed
Page 601
1st paragraph

Change https://tinyurl.com/HeadFirstAndroid to http://tinyurl.com/HeadFirstAndroidPizzaImages

Dawn Griffiths
Dawn Griffiths
 
Sep 15, 2015  Jan 22, 2016
PDF
Page 601
Code notes

Wording error:
Each Pizza has a name and image resource ID. The image resource ID refers to the drink images we added to the project above.

Correction:
Each Pizza has a name and image resource ID. The image resource ID refers to the pizza images we added to the project above.

Or, simply:
Each Pizza has a name and image resource ID. The image resource ID refers to the images we added to the project above.

Anonymous  Mar 16, 2017 
PDF, Mobi
Page 605
1st paragraph

<quote>A recycler view, however, is more efficient at displaying large data sets. This is because a recycler view reuses (or recycles) views when they are no longer visible on screen, whereas a list view displays a new view for each item that appears on screen</quote>

Paragraph implies reuse of views can not be done with listview, which is not true. Listview can reuse views if getView is properly implemented in adapter. Maybe ease of reuse can be stressed instead .

Note from the Author or Editor:
Change the last sentence of the first paragraph to "This is because a recycler view is designed to reuse (or recycle) views when they are no longer visible on screen."

Aziz G  Oct 13, 2015  Jan 22, 2016
Printed
Page 608
code

The line of code "import android.view.LayoutInflator" should be bold.

Dawn Griffiths
Dawn Griffiths
 
Aug 14, 2015  Aug 21, 2015
PDF
Page 616
Code notes

The code notes font seems to override the code font which make this statement very difficult to parse. (Look at the original text since the code font won't appear in this form.):
This needs to be a Context. If you use this code in an activity, you use this instead of getActivity().

Specifically:
"If you use this code in an activity, you use this instead"

In the first instance of "this" I suppose you mean what the code notes arrow is pointing to (i.e. "getActivity()"), but in the second instance of "this" I suppose you are referring to the Java reserved word "this". It's not at all clear without some sort of font differentiation or way to separate the two different references that use the same word.

Note from the Author or Editor:
Change this to "this" in the third line of the top annotation.

Anonymous  Mar 18, 2017 
Printed
Page 627
2nd paragraph

Change "blank activity" to "empty activity". This is to fit in with changes made to Android Studio since the book was written.

Dawn Griffiths
Dawn Griffiths
 
Dec 11, 2015  Jan 22, 2016
PDF
Page 657
Paragraph 1

Wording error:
All of the apps running on your Android device sending their output to a central stream called the logcat.

Correction:
All of the apps running on your Android device send their output to a central stream called the logcat.

Anonymous  Mar 19, 2017 
ePub
Page 686
Chapter 10 > Create StoresFragment > first paragraph

“We’ll use a ListFragment called StoresFragment to display the list of pasta”.

It would be "a list of stores".

Greetings ^^

Note from the Author or Editor:
This is on page 404 of the printed book.

Eduardo Jiménez  Aug 20, 2015  Aug 21, 2015