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 copyright

Add credit to copyright page: Brain image on spine: Eric Freeman

O'Reilly Media, Inc.
 
Apr 10, 2018 
PDF
Page 1
[Early Access] Chapter 3, pg. 1, second paragraph below image

Within the second paragraph below the image, the means of communication described is the communication among activities within a single app. So this paragraph should probably be changed from: "We’re going to show you how to build apps with multiple activities, and how you can get your apps talking to each other using intents." to: "...and how you can get your activities talking to each other using intents."

ikrotzky  Mar 18, 2017  Jul 27, 2017
Safari Books Online
1
CHANGES TO THE XML... in the third sentence

The sentence "Try this now. Update your activity_find_beer.xml code with the following chanes (highlighted in bold):" contains a typo, "chanes" rather than "changes"

Note from the Author or Editor:
This is in Chapter 2, page 47

Anonymous  Jun 18, 2017  Jul 27, 2017
PDF
Page 2
[Early Access] Chapter 2, pg. 2, last bullet point's number (left side of page)

Duplicate number (3) within the bullet points describing the app's structure (left side of page): Item #4 ("The custom Java class contains the application logic for the app.") is currently numbered as #3 (= same number as "The activity specifies how the app should interact with the user.")

ikrotzky  Mar 18, 2017  Jul 27, 2017
PDF
Page 4
Chapter 2, page 4 (preliminary), Section "Create the project"

Issue: singular vs. plural Section "Create the project" Step (3): Perhaps change from: "We want the app to work... Most Android devices meet this criteria." to: "We want the app to work... Most Android devices meet this criterion."

ikrotzky  Jan 14, 2017  Jul 27, 2017
PDF
Page 5 ff
Section "We’ve created a default activity and layout" ff

Just a question: Now that Android Studio has changed the app wizard's default activity layout template to use by default a ConstraintLayout from the support library instead of the standard framework's RelativeLayout, do you plan to update this section accordingly (to show the generated activity_main.xml layout file with a root ContraintLayout)? Because I guess that would be too much of a hassle (of a rewrite), wouldn't it?! Maybe there's an easier solution to this challenge: Given that there's some time left before your fine book is going to print, and assuming that the two of you might be on good terms with Google's tools team that's responsible for Android Studio (or could send a note to Reto Meier), how about this: Why not just ask them politely :-) to put in the app wizard, within the "Customize the Activity" screen, a textbox or spinner below the name of the layout file that's going to be created, somewhat like this: Activity Name: [MainActivity ] [X] Generate layout file? Layout file name: [activity_main ] [X] Backwards compatibility? (AppCompat) Root layout: [ConstraintLayout ] That would be kind of a win-win situation, because a) that's what the "New Activity" wizard already offers anyway, and b) I assume there's quite a couple of devs out there who would appreciate this feature, too, and c) it would only require you to indicate to your readers to exchange the "ConstraintLayout" for a "RelativeLayout", without much of a rewrite. Cheers, ikr P.S. There's of course the possibility to edit the templates used by the wizards. http://stackoverflow.com/a/36654035/3141545 For beginners however, that would probably not be the option of choice!?

Note from the Author or Editor:
We've written a new chapter for the latest version of the book that covers constraint layouts.

Ingo Krotzky  Jan 17, 2017 
PDF
Page 5
Section "The Android SDK"

Within the graphic that depicts libraries and tools, the item at "5 o'clock" "Google Play Billing Allows you in integrate billing services in your app." Maybe that should be: "... Allows you to integrate ..." ?

ikrotzky  Jan 14, 2017  Jul 27, 2017
PDF
Page 6
Section "Install Java" (top of page)

The link provided to check for the required JDK version now points to the mere hardware requirements. "http://developer.android.com/sdk/index.html#Requirements" That's because Android Studio 2.2 and higher versions come bundled with a version of OpenJDK, which is also the recommended version to be used for app development in Android Studio: "https://developer.android.com/studio/intro/studio-config.html#jdk" So you may want to update this section accordingly. "The times they are a changin'" Bob Dylan, 1964 ;-)

ikrotzky  Jan 14, 2017 
PDF
Page 6
[Early Access] Chapter 4, pg. 6, comment on the RESET button layout XML

Missing character 'i' in word 'it' Within the comment attached to the RESET button layout XML, the character 'i' is missing in the word 'it': "This is for the Reset button. When it gets clicked t calls onClickReset()." should read: "...When it gets clicked it calls onClickReset()."

ikrotzky  Apr 03, 2017  Jul 27, 2017
PDF
Page 6
[Early Access] Chapter 4, pg. 6, section "The stopwatch strings.xml file"

Missing word "they" The paragraph "These values are String resources, so need to be added to strings.xml." could be changed to "...so they need to be added..."

ikrotzky  Apr 05, 2017  Jul 27, 2017
PDF
Page 6
[Early Access] Chapter 7, pg. 6, Section "Support libraries allow you to use new features in older versions of Android", 2nd paragraph below image

Change of naming convention starting with Support Library release 24.2.0 (August 2016) Your second paragraph below the image states that: "The name of the support library reflects the lowest version number of Android the library is compatible with." This has been true prior to version 24.2.0 of the Support library. Starting with version 24.2.0 however, this has changed. The minimum API level for (most) support libraries has been increased to API level 9. Please see the following links: https://developer.android.com/topic/libraries/support-library/index.html ...and especially the "Caution" subsection. https://developer.android.com/topic/libraries/support-library/index.html#api-versions

Note from the Author or Editor:
We've removed the paragraph that talks about which support libraries work with which API levels. We've adjusted the nearest available NDQs as follows: "Q: What versions of Android can the Support Libraries be used with? "A: It depends on the version of the Support Library. Prior to version 24.2.0, Libraries prefixed with v4 could be used with API level 4 and above, and those prefixed with v7 could be used with API level 7 and above. When version 24.2.0 of the Support Libraries was released, the minimum API for all Support Libraries became API level 9. The minimum API level is likely to increase in the future."

ikrotzky  Apr 20, 2017  Jul 27, 2017
PDF
Page 6
Page 6 [Early Access] Chapter 7, pg. 6, Section "Support libraries allow you to use new features in older versions of Android", 2nd paragraph below image (and also subtext to one of the images)

=This is an update to my question/suggestion as of Apr 20, 2017 = = (Early Access version of book) = In my above mentioned suggestion I've pointed out that the minimum SDK version for most APIs contained in the Support Library has been increased to API level 9, starting with Support Library version 24.2.0. Now, can you hear Britney Spears singing "Oops!...I Did It again"?! As of revision 26.0.0 Alpha 1 they've increased that minimum SDK level even further, to SDK level 14. https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0-alpha1 Couldn't they just have waited 'till *after* the publishing of this fine book?! :-)

Note from the Author or Editor:
We've removed the paragraph that talks about which support libraries work with which API levels. We've adjusted the nearest available NDQs as follows: "Q: What versions of Android can the Support Libraries be used with? "A: It depends on the version of the Support Library. Prior to version 24.2.0, Libraries prefixed with v4 could be used with API level 4 and above, and those prefixed with v7 could be used with API level 7 and above. When version 24.2.0 of the Support Libraries was released, the minimum API for all Support Libraries became API level 9. The minimum API level is likely to increase in the future."

ikrotzky  Apr 22, 2017  Jul 27, 2017
PDF
Page 10
[Early Access] Chapter 4, pg. 10, section "The post() method"

The comment regarding the line of code: handler.post(Runnable); should be changed from : "You put the code you want to run in the Handler’s run() method." to: "You put the code you want to run in the Runnable’s run() method."

ikrotzky  Apr 05, 2017  Jul 27, 2017
PDF
Page 11
"Android Versions Up Close", Table of versions

Maybe add versions 7.1 and 7.1.1 Nougat API Level 25 to the table? (Who'd want to miss out on the GIFs and stickers enabled keyboard?!) :-)

ikrotzky  Jan 14, 2017  Jul 27, 2017
PDF
Page 14
Screenshot of "Customize the Activity" wizard & related text

More recent Android Studio versions show in the App wizard's "Customize the Activity" page below the layout name the additional option to allow for "Backwards Compatibility (AppCompat)" which is ticked by default. Maybe exchange the screenshot for an up-to-date one and also advise the users to "leave the checkbox ticked", because otherwise...havoc. ;-)

Note from the Author or Editor:
We've changed all the screenshots and instructions in the latest version of the book to reflect the changes to Android Studio.

ikrotzky  Jan 14, 2017  Jul 27, 2017
PDF
Page 16
[Early Access] Chapter 7, pg. 16, section "ActionBar vs Toolbar", last paragraph

Word "it" can be deleted Change paragraph from: "Toolbar is a type of view which you add it to your layout ..." to: "Toolbar is a type of view which you add to your layout ..."

Note from the Author or Editor:
"A toolbar is a type of view which you add to your layout..."

ikrotzky  Apr 20, 2017  Jul 27, 2017
PDF
Page 17
Section "Useful files in your project", description of the "res" folder

"You can find system resources in the res folder. ..." Maybe that should read: "You can find app resources in the res folder. ..." While indeed a good deal of the resources found there have been automatically provided _by_ the Android system, the "system resources" actually reside in a not-so-mundane, affluent neighborhood. But that's of course just splitting hairs... ;-)

ikrotzky  Jan 14, 2017  Jul 27, 2017
PDF
Page 19
Description of the TextView element at the bottom, left

"Make the text wrap horizontally and vertically" Actually, no. It commands the layout to "Make the element just wide and tall enough to accommodate for the text size's (contents) needs" Splitting hairs, again. I know...<sigh>

Note from the Author or Editor:
We've changed the wording to "Allow the text to wrap horizontally and vertically"

ikrotzky  Jan 14, 2017  Jul 27, 2017
PDF
Page 23
[Early Access] Chapter 2, pg. 23, last paragraph, last sentence

Typo in last paragraph / last sentence: "Those are all the changes you need in order to get the spinner to display a list of values. Let's se what it looks like." should be: "...Let's see what it looks like."

ikrotzky  Mar 18, 2017  Jul 27, 2017
PDF
Page 23
[Early Access] Chapter 5, pg. 23, section "Move the button to the right with layout-gravity"

Suggested word replacement: Lower half of page, sub-section "The android:layout_alignEnd attribute only applies to relative layouts.", 2nd paragraph: Currently reads: "Many attributes, however, are specific to one particular type of attribute." Should probably read: "Many attributes, however, are specific to one particular type of layout."

ikrotzky  Apr 11, 2017  Jul 27, 2017
PDF
Page 24
Chapter 3, pg. 24, (Mar 27 '17 early access revision)

== Possibly missing word "which" == First section on this page regarding the "three questions we need answers to before we can call activities in other apps:" First bullet point: "How do we know activities are available on the user’s device?" Should possibly read: "How do we know which activities are available on the user’s device?" Kind regards, ikr

ikrotzky  Apr 02, 2017  Jul 27, 2017
PDF
Page 24
[Early Access] Chapter 3, pg. 24, Section "Here’s what you’re going to do", 2nd item

Missing space between two words Within the 2nd item's first paragraph... "(2) Allow the user to choose which app to use." ...there's a blank missing between "user's" and "device": "Chances are there’ll be more than one on the user'sdevice capable of..." Maybe also add the word "app", like so: "Chances are there’ll be more than one app on the user's device capable of..." Kind regards, ikr

ikrotzky  Apr 02, 2017  Jul 27, 2017
PDF
Page 24
[Early Access] Chapter 8, pg. 24, section "Use the fragment manager to manage fragments"

Missing 's' with second occurrence of 'deals': "The getSupportFragmentManager() method gets a reference to the fragment manager that deals with fragments from the Support Library like ours, and the getFragmentManager() method gets a reference to the fragment manager that deal with fragments that use the native Android fragment class instead." should read: "... and the getFragmentManager() method gets a reference to the fragment manager that deals with fragments that use the native Android fragment class instead."

ikrotzky  Apr 21, 2017  Jul 27, 2017
PDF
Page 26
[Early Access] Chapter 9, pg. 26 and pg. 31, source code for class MainActivity

Within the source code for class MainActivity there's a method onShowDetails(View view), right below method onCreate(). Up to this point in the book, however, this method hasn't been introduced. (This refers to the "Early Access" version of the e-book, as of 2017, Apr 21st). The last time the source code for MainActivity has been printed prior to chapter 9, pg. 26 was in chapter 8, pg 48, section "MainActivity needs to implement the interface". Maybe you'll want to have such a method later on in the app. But at the time of this writing, chapter 9 is the last chapter available, so I can't tell. Anyway, you'd probably want to delete this method (for now) on pages 26 and 31, and also update the comments (drawings) pertaining to this method accordingly: "We've not changed either of these methods" on ch. 9, pg. 26, and "We haven't changed these methods" on ch 9, pg. 31 Cheers!

Note from the Author or Editor:
We've cleared up the code in the latest version.

ikrotzky  Apr 21, 2017  Jul 27, 2017
PDF
Page 28
[Early Access] Chapter 2, pg. 28, bottom of page, method's doc comment

Method onClickFindBeer() doc comment: //Call when the user clicks the button should probably read: //Called when the user clicks the button

ikrotzky  Mar 18, 2017  Jul 27, 2017
PDF
Page 28
[Early Access] Chapter 8, pg. 28, section "Fragments inherit lifecycle methods", last paragraph on page

missing space between "you" and "understand": The last paragraph currently reads: "Now that youunderstand the fragment’s lifecycle better ..." but should read: "Now that you understand the fragment’s lifecycle better ..."

ikrotzky  Apr 21, 2017  Jul 27, 2017
PDF
Page 31
[Early Access] Chapter 7, pg. 31,section "2. Create the menu resource file"

The 4th paragraph describes the path the menu resource .xml file will be placed in: "We’re going to create a new menu resource file called menu_main.xml in the folder app/src/main/res/menu. All menu resource files go in this folder." OK so far. However, the next paragraphs states: "To create the menu resource file, highlight 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." Which would have that menu_main.xml file float around directly in the /res folder. Thus, perhaps update these paragraphs somewhat like so: "To create the menu resource file, first check if Android Studio has already created a menu resources folder for you, at app/src/main/res/menu. If such a menu folder doesn't exist yet, just create it now by right clicking on the /res folder and selecting "New | Android resource directory" and selecting "menu" from the "Resource type" drop down. Once that menu folder exists, highlight it, go to the File menu, and choose New. Then choose the option to create a new Android resource file."

Note from the Author or Editor:
We've added extra instructions to make sure the directory name in the dialog is "menu". This creates the menu folder and adds the menu resource file to it.

ikrotzky  Apr 20, 2017  Jul 27, 2017
PDF
Page 37
[Early Access] Chapter 8, pg. 37, section "Adapters revisited", block between the images

delete word "you": The second paragraph between the two images (general use of adapters and specific use in our workout app case), currently reads: "As you may you recall, an array adapter is a type of adapter that’s used to bind arrays to views." but should read: "As you may recall, ..."

ikrotzky  Apr 21, 2017  Jul 27, 2017
PDF
Page 40
[Early Access] Chapter 9, pg. 40, "BULLET POINTS", 3rd bullet point

Delete word "you": The 3rd bullet point currently reads: "The <FrameLayout> element blocks out space in you your layout..." Should read: "The <FrameLayout> element blocks out space in your layout..."

ikrotzky  Apr 21, 2017  Jul 27, 2017
PDF
Page 41
[Early Access] Chapter 3, pg. 41, Q/A section, last Q/A pair, answer

Maybe advise the reader to use the resolveActivity() method I know there's hardly room for extensive answers within these Q/A pairs. However, maybe you'd still like to point the reader to using the resolveActivity() method on the send intent wrapped in an if(...) condition, as described in: https://developer.android.com/guide/components/intents-filters.html#ExampleSend instead of wrapping the startActivity() call in a try/catch block? Best regards, ikr

Note from the Author or Editor:
We've removed the second paragraph on that page, and replaced the final sentence in the final answer with "You can check whether any activities on the device are able to receive the intent by calling the intent's resolveActivity() method and checking its return value. If its return value is null, no activities on the device are able to receive the intent, so you shouldn't call startActivity(). "

ikrotzky  Apr 02, 2017  Jul 27, 2017
PDF
Page 59
[Early Access] Chapter 5, pg. 59, section "Adding images to buttons", last paragraph on page

Wrong attribute in the description preceding the XML snippet (copy-and-paste error): Currently reads: The android:drawableBottom attribute displays the image above the text: But should read: The android:drawableTop attribute ... <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableTop="@drawable/android" android:text="@string/click_me" />

ikrotzky  Apr 14, 2017  Jul 27, 2017