Errata

Android Cookbook

Errata for Android Cookbook

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
PDF
Page 252
the 1st line (import)

I suggest to delete the 1st import statement:
import com.google.android.maps.GeoPoint;

because example is not connected with Google Maps. Additionally, if you want to build this example as it is you have to build for target Google API which has is not theme of this example at all.

Note from the Author or Editor:
Fixed in SVN

Anto Jurkovic  Dec 02, 2012 
PDF
Page 165
Problem subchapter

Problem is described as

"You need to pass information or data from a service or other background task to an activity. Because activities run on the UI thread, it is not safe to call them from a background thread. This will cause the Activity to be called at the handleMessage() method,
but on the event thread so you can safely update the GUI."

The last statement should not be there because it is part of solution. See also http://androidcookbook.com/Recipe.seam?recipeId=921

Note from the Author or Editor:
Fixed in SVN

Anto Jurkovic  Nov 30, 2012 
PDF
Page 155
Discussion

In order to get notification for your intent filter, you must also specify permission RECEIVE_BOOT_COMPLETED in manifest file

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

From android documentation:
RECEIVE_BOOT_COMPLETED permission: Allows an application to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting. If you don't request this permission, you will not receive the broadcast at that time.

See also http://stackoverflow.com/questions/2784441/trying-to-start-a-service-on-boot-on-android

Note from the Author or Editor:
Added in SVN.

Anto Jurkovic  Nov 30, 2012 
PDF
Page 146
onClick(View view) method

All references
android.content.Intent.SOMETHING
could be shortened to
Intent.SOMETHING
because there is import statement at the beginning of the source file:

import android.content.Intent;

Note from the Author or Editor:
Agreed.

Anto Jurkovic  Nov 30, 2012 
PDF
Page 536
2nd Paragraph (Discussion)

The discussion text says that the result of the recipe's code will be shown in Figure 16-8, but Figure 16-8 shows the output from the following recipe...which doesn't mention the figure at all!

Note from the Author or Editor:
Actually it turns out that Recipe 16.13 was unlucky - it was almost a duplicate of 16.5, so it has been suitably disposed of. The figure xref has been moved to the TabView recipe, where it belongs.

Joseph Eddy  Nov 28, 2012 
PDF
Page 155
Discussion

ServiceManager is most probably part of some package so there should be '.' (dot) in front of name in manifest file:

<receiver android:name="ServiceManager">
to be changed to
<receiver android:name=".ServiceManager">

Note from the Author or Editor:
Fixed in SVN

Anto Jurkovic  Nov 22, 2012 
PDF
Page 144
4.3 Emailing Text from a View

1. during editing of AndroidManifest.xml Eclispe reported that 4 <uses-permission> elements (included in <application> element) had to be moved to manifest root element.

Additionally, some of those elements are ended by '/>' some with '</uses-permission>' which is correct but inconsistent.


2. Build of project reports the following error:

res\values\strings.xml:16: error: Apostrophe not preceded by \ (in Lorem Ipsum is simply dummy text...

Also, there is a warning that Main.tag is there but not used. Most probably leftover of some debugging:

private static final String tag = "Main";

Note from the Author or Editor:
Moved and shortened the uses-permission elements.

Main.tag is not worth fixing.

Fixed the apostrophe in the github project too.

Anto Jurkovic  Nov 22, 2012 
PDF
Page 94
Example 2-18, onCreate() method

DigitsKeyListenerdigkl1 should be with space in between: "DigitsKeyListener digkl1=..."

Note from the Author or Editor:
Fixed in SVN.

Anto Jurkovic  Nov 21, 2012 
PDF
Page 76
Example 2-6

android:layout_below is not valid for LinearLayout. The line

android:layout_below="@id/image"

should be deleted to get rid of warning message

Note from the Author or Editor:
Fixed in SVN. github code was already OK.

Anto Jurkovic  Nov 21, 2012 
PDF
Page 47
Code: Row 2, EditText

android:layout_span="3" has to be android:layout_span="2". The same as Row1: EditText

Note from the Author or Editor:
Fixed in SVN and online. Github doesn't need it as it is already updated to add one feature here, changing the layout file a bit.

Anto Jurkovic  Nov 20, 2012 
PDF
Page 20
Solution subchapter

"The class android.Activity provides..." should be "The class android.app.Activity provides..."

Note from the Author or Editor:
Agreed it's a typo. Corrected in SVN.

Anto Jurkovic  Nov 20, 2012 
PDF
Page 455
3rd Paragraph

There is a reference to the "sentMultipartTextMessage()" method that should be "sendMultipartTextMessage()".

Note from the Author or Editor:
Agreed it's a typo. Corrected in SVN.

Joseph Eddy  Nov 19, 2012 
PDF
Page 5
Example 1-2

In order for this example to compile, you need to add the following import line:

import android.os.*;

Also, it's a little confusing that the example code for setting up the project sets up "FooActivity", but then refers to "HelloWorld.java" instead of "FooActivity.java", and likewise that the class in "HelloWorld.java" is called "Hello" instead of "HelloWorld".

Note from the Author or Editor:
Agreed, Corrected in SVN both parts (other than the import, which most of our examples exclude as per the Preface)

Joseph Eddy  Oct 19, 2012 
Printed
Page 61
top of page, url for source code tipster.zip

The server "http://www.vidyut.com/" can not be found, thus the tipster source code can not be downloaded.

Note from the Author or Editor:
Changed from "Serious technical mistake" to "Update"; it is obviously not a mistake in the book that a web site goes away after the book was published.

Admittedly the server is down. I will contact the author to try to find additional download locations.

--- Later ---

The web site is indeed gone. The code has been put into the GITHUB repo, and the book's manuscript updated to reflect this.
Thanks.

Rick Isaacs  Jun 28, 2012 
Printed, PDF
Page 363
4th and 5th paragrap

In a couple of places, the method name is incorrectly replaced by a dollar sign ('$'). Needs to be clarified.

Note from the Author or Editor:
Confirmed; will update in XML for next printing.

Anonymous  May 06, 2012 
PDF
Page 70
United States

In the AndroidApplication class (Example 2-2) you define something called a SessionHandler. This class does not exist in the Android SDK and is not defined in your book. What is it?

Thanks

Note from the Author or Editor:
I believe this was intended to represent a generic application-specific class, but have contacted the contributor of this recipe to confirm that that was the intention.

Mark Phillips  May 04, 2012 
Other Digital Version
recipe 2-2
United States

In recipe 2-2 (regarding starting a service from an application), the example will [almost] work (after fixing the class name previous reported).

The manifest file must be updated as well to notify it that there is a service (and which class).

For example:
...service android:enabled="true" android:name=".GpsService" ...

Note from the Author or Editor:
This was corrected during Early Release prior to the First Edition. Thanks.

Dave Chamberlain  Mar 11, 2012 
Other Digital Version
3193
Example 2-1/2-2

Example 2-1 and 2-2 appear to be inconsistent, error is mirrored in the text as well.

Example 2-1 uses "GpsService.class"
Example 2-2 has "TrackService" as the class name

The text refers to it as "GPS Service" as well as GPS-using Service.

Note from the Author or Editor:
This was corrected in Early Release before the First Edition. Thanks.

Dave Chamberlain  Mar 11, 2012 
PDF
Page 163
Example 3-10

One of the code comments starts "In you app's android.app.Applicatoin instance...". This contains two typos: "you" should be "your" and "Applicatoin" should be "Application".

Note from the Author or Editor:
One had already been corrected and the other has been fixed. Thanks.

JamesPreston  Dec 04, 2011 
PDF, Other Digital Version
Page 14
USA

activity Name of your "main class" and default name for the
generated .apk file--target HelloActivity

Should be --activity HelloActivity

Note from the Author or Editor:
Confirmed, and fixed in the docbook. Thanks.

John DeHelian  Nov 28, 2011 
PDF
Page 3
Example 1.1

In the PDF version the command line to create the project is cut off.

Reading on Asus transformer tablet with Adobe and Easypdf
Looks fine on Kindle app

Note from the Author or Editor:
I made a pass through the book looking for long lines, so hopefully this one is fixed.

I do wish the build process put a date/timestamp into the book, so we could be sure people were referring to the same version that I think they're working from :-)

Thanks

John DeHelian  Nov 28, 2011