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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
PDF Page XV
3rd paragraph and second title in bold.

In the third paragraph it says:
"But we assume that if you?re holding this book, you really want to learn >>>networking.<<<"

And:
So just how DO you get your brain to treat
>>>networking<<< like it was a hungry tiger?


It should be Android development instead of "networking".

Anonymous  Jul 27, 2011 
PDF Page XV
Second Paragraph

But we assume that if you?re holding this book, you really want to learn
networking.

So just how DO you get your brain to treat networking like it was a hungry tiger?

Should networking in the above 2 sentences be replaced with Android?

David Martirosyan  Sep 08, 2011 
PDF Page jeastorga@gmail.com
jeastorga@gmail.com

The same content/paragraph appears on page v and vi: Your First App
So you're thinking: "What makes Android so special?" .................

I don't know if this was intentional, but it seems like it's duplicated.

Jorge E. Astorga  Sep 12, 2011 
PDF Page 2
2nd paragraph

Text states "With careful planning, you're app ..."

Change "you're" to "your".

spiceisland  Jul 28, 2011 
PDF Page 3
First real paragraph

Text states "There are or course ..."

Change "or" to "of".

spiceisland  Jul 28, 2011 
PDF Page 8
Second "arrow" paragraph

Text states "... of the haiku on it;s own line ..."

Chnage "it;s" to "it's".

spiceisland  Jul 28, 2011 
PDF Page 8
Last paragraph

Text states "Form there, you'll install ..."

Change "Form" to From".

spiceisland  Jul 28, 2011 
PDF Page 9
Paragraph numbered as (3)

Paragraph ends "The ADT is really just a user interface, and
the guts of the app building all happens here in the ADT."

Change last "ADT" to "SDK".

spiceisland  Jul 28, 2011 
PDF Page 10
3rd paragraph

Text states "... development environment,. you can use ..."

Change ",. you" to ", you".

spiceisland  Jul 28, 2011 
PDF Page 12
XML string sample

On page 12 of the sample the string ?name? key got hyphens in them instead of a underscore. (test-image_title)

Anonymous  Aug 27, 2011 
PDF Page 13
1st paragraph

"android.developer.com" should be "developer.android.com"

Anonymous  Jul 28, 2011 
PDF Page 13
Page title

Title reads "Doanload and install the SDK".

Change "Doanload" to "Download".

spiceisland  Jul 28, 2011 
PDF Page 13
Section title

Title says 'Doanload' instead of 'Download'

Ernesto Cullen  Oct 10, 2011 
PDF Page 17
Right-most diagram "arrow"

Text states 'Press "Instal Selected"'

Change "Instal" to "Install".

spiceisland  Jul 28, 2011 
PDF Page 18
End of page

To get project to build, a Build Target must be selected. This is not mentioned or shown on the page 18

Kevin Smith  Jul 28, 2011 
PDF Page 18
3rd paragraph

The actual menu option to create a new Android project is (now, might be different in older than R12/Eclipse 3.7 versions) File->New->Other->Android->Android Project.

jwenting  Aug 30, 2011 
PDF Page 24
Screenshot of AndroidLove app

Screenshot display does not match that created following previous instructions.

Screenshot window-title bar displays "5554:default". However, instructions (on page 23) create a window which actually displays "5554:standard".

Screenshot app displays "Hello World, AndroidLove!". However,
instructions (on page 18) create an app that displays "Hello World, HaikuDisplay!".

spiceisland  Jul 30, 2011 
PDF Page 24
First paragraph

In the first paragraph, "Now that you have an emulator configuration set up, run the app again. Run it the same was as before by pressing the play button in the toolbar."

The sentence "Run it the same was..." Should be "Run in the same way..."

Change "was" by "way".

Jorge Mario Palacio Gomez  Aug 01, 2011 
PDF Page 28
First paragraphs

The second line says Navigate to /res/layout/main.xml in the "exlipse" instead of "eclipse" package explorer and ....

Anonymous  Jul 28, 2011 
PDF Page 28
Folder-layout diagram

Purple folder called "layouts".

Change "layouts" to "layout".

spiceisland  Jul 30, 2011 
PDF Page 29
The IDE graphical editor picture

The picture of the graphical editor looks a bit different than what it currently looks on the IDE.

The version of the ADT that I have is:

Android Development Toolkit

Version: 12.0.0.v201106281929-138431

(c) Copyright 2007-2011 The Android Open Source Project. All rights reserved.

Jorge E. Astorga  Sep 12, 2011 
PDF Page 30
Second answer at bottom-right of page

Seems to be a spurious single-backquote (grave, or ` ) after the word "So".

spiceisland  Jul 30, 2011 
PDF Page 33
1st paragraph

Text states "Right below layouts in the res folder ..."

Change "layouts" to "layout".

spiceisland  Jul 30, 2011 
PDF Page 33
Folder-layout diagram

Purple folder called "layouts".

Change "layouts" to "layout".

spiceisland  Jul 30, 2011 
PDF Page 33
Do this box

Text states "Navigate to the main.xml file in the Eclipse package explorer."

Change "main.xml" to "strings.xml".

spiceisland  Jul 30, 2011 
PDF Page 34
Raw xml screenshot at bottom of page

Screenshot display does not match that created following previous instructions.

Screenshot app displays "Show some love!". However, instructions (on page 18) create an app that displays "Hello World, HaikuDisplay!".

spiceisland  Jul 30, 2011 
PDF Page 35
arrow sign pointing to image

There is a typo after hello World. It says "Sting" instead of String.

monika budhiraja  Jul 28, 2011 
PDF Page 35
1st paragraph

Text reads "... values by select an item ..."

Change "select" to "selecting".

spiceisland  Jul 30, 2011 
PDF Page 38
2nd paragraph, end of the first line.

The text "toadd" is a typo for "to add"

draines  Jan 30, 2012 
PDF Page 38
5th paragraph

read as

Activities describe what your app

Anonymous  Apr 13, 2016 
PDF Page 39
Red-bordered bullet list on right

Fifth bullet point states "Layouts are defined in XML and you can find
them in /res/layouts."

Change "layouts" to "layout".

Six bullet point states "Values (like strings) are defined in Android Resource XML files. They can e found in /res/values."

Change the solitary " e " to " be ".

spiceisland  Jul 30, 2011 
PDF Page 41
In speech bubble in main picture

Says" Its like harding cattle. Harding should be herding.

Kevin Smith  Jul 28, 2011 
PDF Page 43
Second "arrow" note on the left

Text reads "HIde the haiku when the ap loads."

Change "HIde" to "Hide".

Change "ap" to "app".

spiceisland  Jul 30, 2011 
PDF Page 43
Top right, page header.

On this, and other right-side pages, the header is incorrect. It is labelled "working with feeds" instead of the proper chapter title "adding behavior".

draines  Jan 30, 2012 
PDF Page 46
End of 1st paragraph

Text reads "You can find it under /res/layout.main.xml."

A "/" at the end of "layout" has been replaced with a "."

Should read "You can find it under /res/layout/main.xml."

spiceisland  Jul 30, 2011 
PDF Page 46
1st paragraph

"Open main.xmlby by" should be "Open main.xml by"

Anonymous  Aug 02, 2011 
PDF Page 46
1st paragraph, 4th line, first full sentence.

The sentence reads "Open main.xmlby double clicking ...".

The sentence is missing a space after the file name:
"Open main.xml by double clicking ..."

draines  Jan 30, 2012 
PDF Page 47
Text for 2nd red numbered point

Text reads "You?ll the first View defined in the file is the Button you just added!"

Add "see" between "You'll" and "the" (i.e "You?ll see the").

spiceisland  Jul 30, 2011 
PDF Page 47
Raw xml screenshot at bottom of page

When I added a new button, the resulting XML looked quite different from the example given here. The value of the "android:text" attribute was plain "Button" instead of "@+id/Button01".

Following the rest of the instructions to convert this into a string resource worked, so no long term problem. Just very confusing and initially worrying for a noob like myself.

Is there some preferences setting that would affect this sort of behaviour ?

I'm using the latest Eclipse release (Indigo, aka v3.7.0) under Ubuntu 11.04 and the Google's ADK is 12.0.0.v20110628.

spiceisland  Jul 31, 2011 
PDF Page 47
2nd paragraph (numbered 1), 2nd sentence, at the line split.

Missing word, "where the button is going render."

Should be "where the button is going to render."

draines  Jan 30, 2012 
PDF Page 48
2nd paragraph

Text states "... TextView displaying the hauki and the Button ..."

Change "hauki" to "haiku".

spiceisland  Jul 31, 2011 
PDF Page 48
2nd paragraph

The code referred to in chapter 2 seems to have morphed compared to that created in chapter 1.

TextView "android:text" attribute has changed value from "@string/hello" to "@string/haiku".

TextView seems to have gained a new attribute, "android:id", which was missing from the sample XML created in chapter 1.

spiceisland  Jul 31, 2011 
PDF Page 48
2nd text box.

In this text box and throughout the chapter, it is apparent that the name of the text string created in the first chapter has been changed from "hello" to "haiku". This problem shows up throughout the chapter and causes a bit of confusion.

draines  Jan 30, 2012 
PDF Page 51
2nd paragraph, 2nd sentence.

The sentence reads: "Open strings.xml and click on the strings.xml."

This is entirely unclear on what a person should do. Suggested rewrite could be along these lines: "Click on the strings.xml tab at the top of the editing area to select that file. Then click on the strings.xml tab at the bottom of the editing area to open select the XML view of the file."

draines  Jan 30, 2012 
PDF Page 56
2nd paragraph

Text reads "You could remove the TextView and it back
once ..."

Add "add" between "and" and "it" (i.e "and add it").

spiceisland  Jul 31, 2011 
PDF Page 57
Top-right "arrow" text

Text states "If you know the class you're looking for, but now the package, you can type it in here to search the documentation."

Perhaps change "now" into "not" ?

spiceisland  Jul 31, 2011 
PDF Page 57
top left caption/comment of the screenshot

the sentence should read "This area lists all of the packages in.." instead of "This area lists all of the packes in..."

GreenITGuy  Jul 31, 2011 
PDF Page 57
Top right comment/caption on the screenshot

2nd line should read "looking for, but not the package," instead of "looking for, but now the package"

GreenITGuy  Jul 31, 2011 
PDF Page 64
Sample of XML at bottom of page

Example XML has Button "android:text" attribute value set to "@+id/Button01?.

Change value to "@string/love_button_text" to match instructions given earlier in chapter.

spiceisland  Jul 31, 2011 
PDF Page 64
2nd paragraph

Give is a value of onLoveButtonClicked to be descriptive of what the Button is supposed to do.

Change "Give is a value" to "Give it a value"

David Martirosyan  Sep 15, 2011 
PDF Page 66
Folder-layout diagram

This example of folder hierarchy does NOT match what you get from following the instructions in chapter 1.

The actual hierarchy is:

AndroidLove -> src -> android.love -> HaikuDisplay.java

spiceisland  Jul 31, 2011 
PDF Page 68
First paragraph

Should say onLoveButtonClicked instead of onLoveVuttonClicked.
on paragraph:
"Let?s add the onLoveVuttonClicked method to
AndroidLove now. Once this is done, we can run ..."

Juan Hernandez  Jul 27, 2011 
PDF Page 68
Code sample

My code would not run until I added the following line:

import android.view.View;

spiceisland  Jul 31, 2011 
PDF Page 68
2nd paragraph

The paragraph starting "The new onLoveVuttonClicked method..." should be "The new onLoveButtonClicked method..."

Claus Jensen  Aug 02, 2011 
PDF Page 70
First paragraph

A parenthesis starts but it does not end.
In the paragraph:
You?ve got a disconnect right now. Your screen Views
>>>>>> ( <<<<<< the Button and the TextView displaying the haiku
are defined in XML in the main.xml layout. But you
action code is defined in Java in the AndroidLove
Activity. How are you supposed to get references to
XML defined Views from your Java code?


Juan Hernandez  Jul 27, 2011 
PDF Page 70
Second paragraph, The 'R' file

On the second paragraph subtitled: The 'R' file, it seems like the first sentence is missing a noun.

'To solve this, Android generated a special <?> called ..."

Jorge E. Astorga  Sep 12, 2011 
PDF Page 70
1st paragraph

But you action code is defined in Java in the AndroidLove Activity.

Change "But you" to "But your"

David Martirosyan  Sep 15, 2011 
PDF Page 70
"The 'R' file" paragraph

sentence:

To solve this, Android generated a special called the ?R? file.

There's a missing "file" word.

Virginie  Nov 08, 2011 
PDF Page 70
"Do this!" section

The text assumes the existence of some "com/headfirstlabs" path/package while the reader following the book didn't create any.

Virginie  Nov 08, 2011 
PDF Page 72
.

The page is missing the Imports. Without the Imports the program will not
work. I did not know that Imports were required. I started from scratch 3
different times and still could not get the program to run. Then a google
search revealed the Imports. After adding the proper imports, the program
worked fine. If this book is to teach people how to program the Android,
adding the Imports should be mentioned in the book. Anybody not familiar
with programming would have never figured out how to get the program to
work.

Anonymous  Oct 24, 2011 
PDF Page 74
first paragraph

"an R file constant will getgenerated."

missing white space after "get"

Virginie  Nov 08, 2011 
PDF Page 76
na

No mention is made on this or the preceding pages of the imports needed to get View and TextView to work.

A paragraph should be inserted telling the user that they need to add the following to their .java file

import android.view.View;
import android.widget.TextView;

And also explain how the user can work out from the online developer guide what imports are required for a given class.

Albert White  Oct 07, 2011 
PDF Page 76
Action Magnet Snippets

Also affects page 75 and the source code download for Chap02.

When running under Honeycomb 3.2 I needed to include the line

textView.setText(R.string.haiku);

before the line

textView.setVisibility(View.VISIBLE);

The missing line (setText) is included in the source code download for Chap02, but the code is missing the 'setVisibility' line.

James Lyle  Oct 09, 2011 
PDF Page 78
Next to last bullet in the pull-out box.

The next to last bullets need some editing.

From:
"to use Use the android:onClick property on Button to add an action method. That action method ..."

Possible to:
"Use the android:onClick property for the Button object to add an action method. That action method ..."

draines  Jan 30, 2012 
PDF Page 82
3rd paragraph

Go to http://www.nasa.gov/rss/image_
of_the_day.rss

Link wraps to next line. When you click on the link it takes you to http://www.nasa.gov/rss/image_ which of course does not work.

Mike Raben  Jul 29, 2011 
PDF Page 82
First paragraph, second sentence

"app from he image feed" should be "app from the image feed"

change "he" to "the"

Jorge E. Astorga  Sep 13, 2011 
PDF Page 82
xml editor diagram

The image tag doesn't seem to be in the xml any longer.

David Martirosyan  Sep 18, 2011 
PDF Page 86
2nd bullet point

It says : Update CreateMessageActivity.xml so that it gets the text the user inputs.

It should says : Update CreateMessageActivity.java so that it gets the text the user inputs.

Rohit  Sep 16, 2015 
PDF Page 87
thought bubble

I can?t want to see it working!

Change "want" to "wait"

David Martirosyan  Sep 18, 2011 
PDF Page 88
Project Name info text

But It?s better leave out spaces

1. Make "It's" lower case.
2. Add "to" after "better"

David Martirosyan  Sep 18, 2011 
PDF Page 88
Build Target info text

Select the latest platform you have installed (2.3 at the timeof this writing

Change "timeof" to "time of"

David Martirosyan  Sep 18, 2011 
PDF Page 90
Image

Naming the 3 strings "test-image_title, test-image_date and test-image_description" leads to a compiling error in the R.java file:
Multiple Markers at this line
-Syntax error on token "-"

I fixed by changing string names to testImage_title etc.

Mike Raben  Jul 29, 2011 
PDF Page 91
do this box

res/drawable_hdmi should be res/drawable_hdpi

james findlay  Aug 02, 2011 
PDF Page 92
Code in TextView Tags

test_image_title, test_image_description, test_image_date use underscore between "test" and "title", while on page 90 they use hyphens ( test-image_title, test-image_date, test-image_description ).

David Martirosyan  Sep 20, 2011 
PDF Page 94
Code in TextView Tags

test_image_title, test_image_description, test_image_date use underscore between "test" and "title", while on page 90 they use hyphens ( test-image_title, test-image_date, test-image_description ).

David Martirosyan  Sep 20, 2011 
PDF Page 100
1st paragraph

You were to used the ScrollView to make the entire screen scroll.

Change "used" to "use"

David Martirosyan  Sep 20, 2011 
PDF Page 104
Ready Bake Code

There are a few errors with SAX parsing example that make it much more difficult than it should be at that point in the book. It took me quite a while to work through all of the errors and get the example app working.

One problem is actually with the RSS feed used for the example. Images won't show up in the app because there is not a "url" tag in NASA's xml feed. Instead, the image URL is an attribute of the "enclosure" tag:
<enclosure length="12345" type="image/jpeg" url="http://www.nasa.../>

To fix it:
In the startElement 'if' blocks, you would change the line:
if (localName.equals(?url?)) { inUrl = true; }
else { inUrl = false; }

and call the .getValue("url") on your Attributes variable:

if (localName.equals("enclosure")) { inUrl = true; imageUrl=attributes.getValue("url");}
else { inUrl = false;}

then call the call to getBitmap to:
if (inUrl && imageUrl != null) {image = getBitmap(imageUrl);}

Mike Raben  Jul 30, 2011 
PDF Page 105
ready bake code

the method public String getImage() can't possibly work as its return value is not a String but a Bitmap.

Return type of this method should reflect this, yielding public Bitmap getImage() {return image;}

jwenting  Aug 31, 2011 
PDF Page 105
SAX Parse Ready Baked Code

The XML parser code should be handle the fact that data from the rss are grabbed in chunk, otherwise you could have only a little part of the description of the image.
It is a FAQ of the SAX.

Alessandro Boggiano  Sep 02, 2011 
PDF Page 105
Do this! box at bottom of page

The box reads: Download the IotdHandler code
from the Head First Android Development
site and add it to your project.

The downloaded code will not work with the rest of the example since on page 106 it says to call

handler.processFeed();

but in the downloaded class the method looks like below.

public void processFeed(URL url)

David Martirosyan  Oct 09, 2011 
PDF Page 106
2nd paragraph

"afterprocessFeed() returns" is missing a space (ie, should be "after processFeed() returns"

james findlay  Aug 03, 2011 
PDF Page 106
from here on

The network calls made in processFeed() and the completely unmentioned getBitmat(), which can only be found in the online code, will not work.

I don't know when the restriction on putting networking calls in the UI thread was introduced to Android but you can't do this with 2.3 onward. Both these functions should be put in a separate thread in order to work. This is quite a large change, even from the program in the public SCM for the book.

I suggest that:
* getBitmap is moved to IotdHandler and stores the Bitmap as an attribute, automatically fetching it when the feed is processed

* resetDislpay modified to get the Bitmap from IotdHandler

*onCreate() for NasaIotd should something like this:

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
iotdHandler = new IotdHandler();
// try {
// Log.i(TAG, "processing : " + URL);
// iotdHandler.processFeed(this, new URL(URL));
// resetDisplay(iotdHandler.getTitle(), iotdHandler.getDate(), iotdHandler.getUrl(), iotdHandler.getDescription());
// } catch (Exception e) {
// e.printStackTrace();
// }
new FetchFeed().execute();
}

* an inner class added to NasaIotd:

private class FetchFeed extends AsyncTask<Void, Void, Void>{

protected void onPostExecute(Void param) {
MainActivity.this.resetDisplay(iotdHandler.getTitle(),
iotdHandler.getDate(), iotdHandler.getDescription(),
iotdHandler.getImage());
}

protected Void doInBackground(Void... params){
try {
iotdHandler.processFeed(MainActivity.this, new URL(URL));
} catch (MalformedURLException e) {
e.printStackTrace();
Log.e(TAG, e.getMessage());
}
return null;
}

}

Peter Shannon  Aug 08, 2012 
PDF Page 106
onward

Adding this to the onCreate() method will disable strict mode for networking.

StrictMode.ThreadPolicy threadPolicy = new
StrictMode.ThreadPolicy.Builder().permitNetwork().build();
StrictMode.setThreadPolicy(threadPolicy);

Peter Shannon  Aug 12, 2012 
PDF Page 108
Code Magnets

Copying the code given into the NasaDailyImage.java file will result in several errors.
First is with the resetDisplay method parameters. description should be a StringBuffer instead of a String.

The call to this method on page 109 is also incorrect. It calls the parent methods of each parameter:

resetDisplay(iotdHandler.getTitle(), iotdHandler.getDate(),
iotdHandler.getImage(), iotdHandler.getDescription());

This results in an error for each of the methods called. One way to fix is to set each of those methods and their variables to static in the IotdHandler.java file.
A better fix would simply be to call the methods on the handler object you created:
resetDisplay(handler.getTitle(), handler.getDate(), handler.getImage(), handler.getDescription());

Mike Raben  Jul 30, 2011 
PDF Page 110
entire page

Using R12 SDK/emulator against Android 2.2, no IOException is generated. The only thing returned is a vague "permission denied".
Of course this never gets printed to the log because of the try...catch in IotdHandler which silently ignores the exception and continues as if nothing happened.
It wasn't until I changed the code into
URL dataUri = new URL(url);
InputStream inputStream = dataUri.openStream();
reader.parse(new InputSource(inputStream));
} catch (Exception e) {
String error = e.getMessage();
System.out.println(e.getMessage());
}

and ran it through the debugger that at least that much was visible.
A watch on the exception shows it to be a java.net.SocketException with no further information.

jwenting  Aug 31, 2011 
PDF Page 111
3rd paragraph

In the 4th line of th 3rd paragraph instead of "requsts" it should be "requests"

Juan Hernandez  Jul 27, 2011 
PDF Page 111
3rd paragraph

You can specity the permissions your app needs using a group of
permission constants in AndroidManifest.xml.

Change specity to specify

David Martirosyan  Oct 09, 2011 
PDF Page 113
2nd paragraph

There are a bunch of different permissions that you can ad to your
application.

Change ad to add

David Martirosyan  Oct 09, 2011 
PDF Page 116
2nd paragraph

To correct the phrase "That tool is rhe Android Hierarchy Viewer.".

Replacing "rhe" for "the".

Thiago Carvalho da Silva  Sep 24, 2012 
PDF Page 117
Image at the bottom of the page

The "written" instruction balloons do not tell the user to click on the "android.widget.ImageView" line so that the ImageView will be highlighted with the red box alluded to by the rest of the instructions.

draines  Feb 13, 2012 
PDF Page 117
Image at the bottom of the page

The "written" instruction balloons do not tell the user to click on the "android.widget.ImageView" line so that the ImageView will be highlighted by the red box alluded to by the rest of the instructions.

draines  Feb 13, 2012 
PDF Page 117
Missing text for the image at the bottom of the page

The "written" instruction balloons do not tell the user to click on the "android.widget.ImageView" line so that the ImageView will be highlighted by the red box alluded to by the rest of the instructions.

draines  Feb 13, 2012 
PDF Page 119
1st paragraph

With the adjustViewBounds properts upated in your
layout, run the app again.

change properts to property
change upated to updated

David Martirosyan  Oct 09, 2011 
PDF Page 121
bullet points box

res/drawable- hdmi should be res/drawable-hdpi

james findlay  Aug 02, 2011 
PDF Page 121
Bullet Points - 3rd bullet

It?s a good practice to break your app down
into small development pieces

Probably should get rid of the "a" after "It's"

David Martirosyan  Oct 09, 2011 
PDF Page 124
1st paragraph - not the bubble

but it?s a idea to understand why
you?re being asked for something.

should "good" be inserted between "a" and "idea"?

David Martirosyan  Oct 10, 2011 
PDF Page 124
Grey text next to code after 3rd paragraph

The grey text reads "You put the code you want to run in the Handler's run() method."

Instead of the "Handler's run() method", it should be the "Runnable's run() method"

Lynn Samson  Jan 09, 2016 
PDF Page 126
2nd paragraph

Let?s build the button bar as a standalone layout and
then add it the app?s current layout.

Should this sentence have a "to" between "it" and "the" to look like the below?

Let?s build the button bar as a standalone layout and
then add it to the app?s current layout.

David Martirosyan  Oct 10, 2011 
PDF Page 126
2nd paragraph

Encapsulating parts of
your fullscreen layout into separate smaller layouts can be a
good way to organize layouts.

change "fullscreen" to "full screen"

David Martirosyan  Oct 10, 2011 
PDF Page 128
page title

"Use properties to fune-tune the layout"
should be
"Use properties to fine-tune the layout"

james findlay  Aug 04, 2011 
PDF Page 128
2nd box

android:margin-top should be android:layout_marginTop here and throughout the book.
Ditto for other layout properties.

jwenting  Aug 31, 2011 
PDF Page 129
1st paragraph

layout-width and layout-height boxes, second box should be layout_width

Mike Raben  Jul 30, 2011 
PDF Page 130
2nd row from bottom

"android:margin-top" attribute is incorrect; should be "android:layout_marginTop"

james findlay  Aug 05, 2011 
PDF Page 130
throughout page

every hyphen on the page should be an underscore.
eg.
wrap-content->wrap_content
layout-width->layout_width

same problem exists on page 132.

james findlay  Aug 05, 2011 
PDF Page 130 and 132
Magnets with the "layout" attribute.

In both of these pages and anywhere else in this chapter that the magnets are used with the "layout_xxx" attribute, the magnet incorrectly uses a dash instead of an underscore. This is true for some of the values as well (i.e. wrap-content instead of wrap_content).

draines  Feb 13, 2012 
PDF Page 131
entire page

page has been erroneously duplicated and should be removed; page exists in its correct position at page 133

james findlay  Aug 05, 2011 
PDF Page 132
1st paragraph

Capitalize the third sentence starting with "you"

David Martirosyan  Oct 13, 2011 
PDF Page 138
entire page

Omission: the button is never hooked up with the event handler (onRefresh()).
A property 'android:onClick="onRefresh"' should be added to the button definition in main.xml.

jwenting  Aug 31, 2011 
PDF Page 144
1st paragraph

You should have also dismissed when dialog once the work is
completed.

Change "when" to "the".
I'm guessing "once the work is completed" should be in the past tense.

David Martirosyan  Oct 13, 2011 
PDF Page 146
1st paragraph

In the sentence: "The UI
thread has a queue of work, and it continually gets the mot important
chunk of work to process."
It should say "more" instead of "mot".

Juan Hernandez  Jul 29, 2011 
PDF Page 146
In the diagram

It should say "Repaint" instead of "Repain" in reference number 2.

Juan Hernandez  Jul 29, 2011 
PDF Page 146
1st Graphic

The second task has a label of "Pperform layout". Should it be "Perform layout"?

David Martirosyan  Oct 13, 2011 
PDF Page 146
2nd Graphic

Task 1 reads "This expensive call on call
on the UI thread keeps
repaints from happening."

"call on" is repeated twice.

David Martirosyan  Oct 13, 2011 
PDF Page 147
Graphic

On Task 2 change "Repain" to "Repaint"

David Martirosyan  Oct 13, 2011 
PDF Page 148
Sample Code

The book doesn't mention that "dialog" now has to be declared as a class variable.

private ProgressDialog dialog;

David Martirosyan  Oct 13, 2011 
PDF Page 173
Code box

ListView code missing line designating "android:id="@+id/times_list"

Leads to errors later in the chapter when assigning the adapter to that id.

Mike Raben  Aug 01, 2011 
PDF Page 174
1st paragraph, 4th lie

possessive apostrophe used for a plural.

"You can populate your ListView?s" should be
"You can populate your ListViews"

james findlay  Aug 05, 2011 
PDF Page 181
near bottom (page is an XML listing)

The second-to-last </LinearLayout> closing tag needs to be moved above the <ScrollView>. As it is, the ScrollView becomes part of the header, which you don't want -- the header for landscape mode should consist of the title, date, and the two buttons.

Also, in the ScrollView opening tag, there's no whitespace between layout_height and layout_weight.

DaveLindsley  Oct 13, 2011 
PDF Page 187
item (2), pixel density

If the smaller screen is supposed to have a greater pixel density ... then aren't the two grids swapped?
That is, shouldn't the grid with the smaller/greater number of squares be on the left (under the smaller screen)?

DaveLindsley  Oct 13, 2011 
PDF Page 190
1st line

"You should have completed the getView method blow"
should be
"You should have completed the getView method below"

james findlay  Aug 05, 2011 
PDF Page 195
4th line from bottom of ready bake code

getImage function returns wrong type.

public String getImage() { return image; }
should be
public Bitmap getImage() { return image; }

james findlay  Aug 04, 2011 
PDF Page 203
sidebar

"When working on a multi-screened app,
always start with your post important use
case." should of course be "When working on a multi-screened app,
always start with your most important use
case."

jwenting  Sep 01, 2011 
PDF Page 203
last paragraph

"That?s why the first AVD that you created had suck big buttons and icons..."
should read
"...such big buttons and icons..."

DaveLindsley  Oct 17, 2011 
PDF Page 205
last line

"make your own Android context men- the menu that pops up when" should be "make your own Android context menu, the menu that pops up when"

jwenting  Sep 01, 2011 
Printed Page 208
bottom

"onToggleClicked" should be "onToggleButtonClicked"

jagath ekanayake  Jul 27, 2015 
PDF Page 209
bottom illustration

"ExitText" should be "EditText"

jwenting  Sep 01, 2011 
PDF Page 227
code box,2nd line

Menu class erroneously shown as argument.
super.onCreateOptionsMenu(Menu m);
should be
super.onCreateOptionsMenu(m);

james findlay  Aug 07, 2011 
PDF Page 229
Ready Bake Code

Eclipse forces the type of onCreateOptionsMenu to be boolean, not void. Fixed by changing the method to:

public boolean onCreateOptionsMenu(Menu m) {
super.onCreateOptionsMenu(m);
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.time_list_menu, m);
return true;
}

Mike Raben  Aug 02, 2011 
PDF Page 229
ready bake code box

function declared as wrong type; onCreateOptionsMenu should be boolean, not void.

ie:
public void onCreateOptionsMenu(Menu m)
should be
public boolean onCreateOptionsMenu(Menu m)

same mistake is made in stub on page 227.

further, function needs to return true.

james findlay  Aug 07, 2011 
PDF Page 231
code box

in the if statement, item.id is not how the item's id is accessed. The code on page 234 correctly shows this as item.getItemId().

Mike Raben  Aug 02, 2011 
PDF Page 231
bottom box

Incorrect method signature. Should be

if (item.getItemId() == R.id.add_time_menu_item) {

}

jwenting  Sep 01, 2011 
PDF Page 231
Different locations

onMenuItemSelected() should be replaced with OnOptionsItemSelected().

Alessandro Boggiano  Sep 02, 2011 
PDF Page 257
code box

RESULT_CANCELLED should be RESULT_CANCELED

james findlay  Aug 13, 2011 
PDF Page 257
2nd paragraph

The request code passed into
startActivityForResult is returned along with
the request code set before finish was called.

I think that it should be:
"The request code passed into
startActivityForResult is returned along with
the result code.... "

Alessandro Boggiano  Sep 02, 2011 
PDF Page 261
Save Magnets Solution

The method addTimeRecord(TimeRecord) is not defined anywhere.

Also, if such method is applied on the class, should the data structure times defined as static ?

Alessandro Boggiano  Sep 02, 2011 
PDF Page 271
First paragraph, Last line

The last sentence of the first paragraph states "Then using a database API, your app would connect to the database and query or addsdata to the database."

This looks like it should be "add data" not "addsdata".

ecsa0014  Sep 16, 2011 
PDF Page 276
code block

The inner class definition should be

private static class TaskOpenHelper extends SQLiteOpenHelper {

public TaskOpenHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

}

}

with whatever's needed for the onCreate and onUpgrade methods (haven't gone into those yet).

jwenting  Sep 08, 2011 
Printed Page 281
code

package com.hfad.workout;

import android.app.Activity;
import android.os.Bundle;



public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

WorkoutDetailFragment frag = (WorkoutDetailFragment) getFragmentManager().findFragmentById(R.id.detail_frag);
frag.setWorkout(1);

}
}


Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
C:\Murach\android\ex_starts\Workout\app\src\main\java\com\hfad\workout\MainActivity.java
Error:(15, 99) error: incompatible types: Fragment cannot be converted to WorkoutDetailFragment
Information:Gradle tasks [:app:assembleDebug]
Information:0 warnings
Information:2 errors
Information:BUILD FAILED
Information:See complete output in console

Anonymous  Jan 08, 2017 
PDF Page 284
Chapter 7 (lists and adapters) >> Page 284 (Sharpen your pencil) >> "Below is the TimeTrackerAdapter code" creation code

Hi,

I noticed a piece of code which can lead to infinite loop. Here is the location:

Chapter 7 (lists and adapters) >> Page 284 (Sharpen your pencil) >> "Below is the TimeTrackerAdapter code" creation code

public Object getItem(int index) {
return getItem(index);
}

The above code is recursively calling itself. The correct code should be:

public Object getItem(int index) {
return times.get(index);
}

Thanks,
Raghav
http://codeasp.net/

Raghav Khunger  Oct 05, 2012 
PDF Page 284
In 284 page TimeTrackerAdapter class is missing "addTimeRecord" method which is used later on 338 Page

In 284 page TimeTrackerAdapter class is missing "addTimeRecord" method which is used later on 338 Page

Used in 338 page :
timeTrackerAdapter.addTimeRecord( new TimeRecord(time, notes));

There should be "addTimeRecord" method in TimeTrackerAdapter with this code:
public void addTimeRecord(TimeRecord timeRecord) {
times.add(timeRecord);
}

Raghav Khunger  Oct 05, 2012 
PDF Page 311
bottom

chapter # listed in the page footer is incorrect. Should be 9 rather than 67.

jwenting  Sep 29, 2011 
PDF Page 317
Chapter 7 (lists and adapters) >> 317 page >> Show the menu

Chapter 7 (lists and adapters) >> 317 page >> Show the menu

Semicolon missing :
super.onCreateOptionsMenu(m)

"menu" should be replaced with "m" :
R.menu.time_list_menu, menu );

322 page >> Launching a new Activity Magnets Solution

Semicolon missing:
startActivity(intent)

Raghav Khunger  Oct 05, 2012 
PDF Page 323
end of page

<activity android:name=?.AddTimeActivity?> </activity> MUST between <application> and </application> tag. If not, will always notice: "No activity found".
I think this error is really important, many newbie cannot overcome this error (if they don't have good google skill) :(

Huynh Quang Thao  Feb 27, 2012 
PDF Page 326
Chapter 7 (lists and adapters) >> 326 page >> Implement the button actions

Chapter 7 (lists and adapters) >> 326 page >> Implement the button actions

Variable missing:
Intent = new Intent(this, TimeTracker.class);

It should be:
Intent intent = new Intent(this, TimeTracker.class);

Raghav Khunger  Oct 05, 2012 
PDF Page 503
1st and 2nd code snippet

the stated is
android:background=?null?

the right is
android:background=?@null?

mamdouhalshamy  Oct 20, 2011