By Developers, For Developers

Historical errata for Hello, Android

PDF PgPaper PgTypeDescriptionFixed onComments
21TYPO

Type typing the word “android” in the Work With field and press. First part doesn’t make sense.

2010-02-16
63ERROR

In page 63 the author asks the user to add the attribute \t\tandroid:theme=“@android:style/Theme.Dialog” to manifest.xml, but in fact this attribute was already declared on page 61. I think this attribute should not be in page 61.

2010-02-16
107TYPO

Written “res/rawdirectory”, should be “res/raw directory”

2010-02-16
116TYPO

“so we put a Music.start( ) call there” should be “so we put a Music.play( ) call there”

2010-02-18
155ERROR

You forgot to include, comment and link TranslateTask,java source code:

“Finally, on line 31, we create an instance of TranslateTask…” but no code given.

2010-03-20I left it out intentionally, but due to popular demand I'll be adding it in a later beta. For now you can get it from the example code zip.
50SUGGEST

LinearLayout xml is split between two pages (49 and 50), with a ‘Joe asks’ box between the two fragments. In addition, the positioning of the second fragment (as the layout stands right now) is crowding the text below and could/should be moved up slightly.

2010-06-23Thanks, we'll fix layout problems like this when the final version of the book is typeset right before it's sent to the printer.
61ERROR

Hi,
when introducing the new Activity “.About” in the manifest for the first time, the code example already adds the theme “Theme.Dialog” attribute, although in the text it is described to first have the default theme (fullscreen).

2010-02-22
77ERROR

Towards the end of the page the text refers to a method Canvas.setBackgroundResource(), which doesn’t exist. It should be View.setBackgroundResource().

2010-03-09
68SUGGEST

I’m following your examples and creating all files by hand. When adding the menu function including all supporting files and directories, Elipse started showing an Problem/error. I had to find the Error log tab to get the detailed error message “gen [in Suduko] does not exist”. I could not run the project until this error was fixed. The fix for the error was to select Project>Clean from the Eclipse menu and tell it to clean the Suduko project. As a new Eclipse/Java developer it took me a while to find this fix. You may want to make note of this in your final book. In your explination it might be nice to tell readers how to find the error log. A person new to Eclipse, like me, may not know where to find it.

This book is excellent, so far. Exactly what I needed to get started.

Thanks!

2010-06-02If you had to go poking around the Error Log tab then something is wrong, maybe a bug in the Eclipse ADT plug-in. Only plug-in developers should have to look there. If you can duplicate the problem please post the steps in the book forum and I'll file a bug report against ADT if it's needed.
70SUGGEST

Small Suggestion

Move Figure 3.11 after the code for the entry of the Prefs activity into the AndroidManifest. Since I’m walking through the code a step at a time the placement of the image, and caption, made me think I was ready to run the program. I was forced to find the bug myself and fix it. As someone new to Eclipse/Android degugging at this point is a bit daunting. Of course, when I continued reading I noticed the missing piece. I like to think I’m a “typical” user and wouldn’t be the only one to make such a foolish mistake.

2010-03-20
198TYPO

The “android:name” of the “provider” tag should be set as “.EventsProvider” instead of “EventsProvider”

2010-04-15
228TYPO

The resource directory name should be “res/drawable-nodpi” instead of “res/drawables-nodpi”

2010-04-15
146SUGGEST

Chapter 7.3 “From Javascript to Java and Back”, p. 146

In res/layout/main.xml, the first TextView has its text set with a literal (“TextView”). To maintain consistency with the practices set in the rest of the book, the text should be set from from the strings.xml file the same way the Button widget in the same layout does.

2010-04-15
31SUGGEST

1.4 Running on a Real Phone

You should mentionn that in addition to installing the driver, you need to activate SettingsApplications>Development->USB Debugging. Because the book told me to look for a USB driver by following footnote 7 (which it turns out I already had installed by following the directions in section 1.2), I clicked on “USB Driver for Windows” in the upper right hand corner when I got to the web page. It would have helped me if the book explicitly told me about the configuation that I needed to do on my droid in the main text.

2010-04-19
264TYPO

This technique is simple can can
be used to handle most API differences, so we’ll use it here.

Should be “and can” not “can can”

2010-04-19
104TYPO

I noticed line numbers on the example code on 103 and 104 pages for the calculateUsedTiles(int x, int y) function

2010-06-02They are supposed to be there. Line numbers show up whenever text references the numbers. After the code you can see references to line 4, line 12, etc..
25TYPO

Step 2: “See the sidebar the Joe Asks…” — extra “the”

2010-05-03
211TYPO

Fixed vs. Floating Point inset, second paragraph: I think you meant 2^16.

2010-05-033 editions and nobody noticed that before. Thanks!
263TYPO

Last sentence of the first paragraph, I think you meant “… by the compiler at build time.”

2010-05-03
232ERROR

In the code example you use the attribute start without saying what it is. I had to look into the code to realize that you ment PointF.

You should add the attribute declaration to the Activity snippet above.

2010-05-17
166TYPO

In the last paragraph on the page, “course” should be spelled “coarse.”

2010-06-02
23ERROR

The book says “I do recommend you add the SDK’s bin directory to your PATH.”
There seems to be no “bin” directory. Do you mean the “tools” directory?

2010-06-22
228TYPO

At the ‘Multi-Touch, Introducing Multi-Touch’ in mobi format book, ‘Figure1. Three common touch gestures…’ may be wrong figure. It’s OK in pdf format.

2010-08-09
1TYPO

On the title page upper right corner it says “Antroid 1.5 to 2.1”. Since beta 6 the book also covers Froyo (Android 2.2)

2010-06-23
23SUGGEST

Now that Eclipse 3.6 has been released the entire “32-bit vs. 64-bit” section can probably be dropped.

2010-08-09I didn't drop it but I reworded it. I still think 32-bit will be easier for most people.
64TYPO

Is it really supposed to say “object to tickle” ?

2010-08-09Yes, it's a synonym for poke or activate.
67OK

The footnote (footnote 4) is cut off midsentence.

2010-08-09The footnote is correct. You should look for symbols that start with the word "Theme_", like "Theme_Black".
64OK

be passed an object that implements
the OnClickListener Java interface. We’re passing it the

should read

be implemented on an object that implements
the OnClickListener Java interface. We’re passing it the

2010-08-09It's correct the way it is now. setOnClickListener takes a parameter which is a reference to an object that implements the OnClickListener interface.
132TYPO

Typo on first line of the page an “a” where the shouldn’t be one, i.e.
“Once you have a the basic program, change the layout file…”

2010-08-09
139OK

Is it worth a comment that when you select a link in a webpage in the BrowserView example it opens up a new browser activity?

2010-08-09Probably not, because in the next example it won't do that.
1TYPO

Not sure if this qualifies as a typo, but the title page notes that this book is for Android 1.5 to 2.1. However, the book does discuss Android 2.2. See PDF page 12, under What’s New in the Third Edition: “The third edition has been updated to support all versions of Android from 1.5 to 2.2 and beyond.” Perhaps the title page graphic is out of date?

2010-08-08The wrong cover was used, but this has now been fixed.
0TYPO

The title of the Mobi/Kindle version says “Hello, Android! 2e”. Should it read “Hello, Android! 3e”?

2010-08-09
55OK

On section 3.4, the first line, it says press CTRL+F11 to switch to landscape. On my computer (win7) I must press the left control + F11. Pressing the right-CTRL + F11 doesn’t switch.

2010-08-09I entered a bug report against the SDK for this one. See http://code.google.com/p/android/issues/detail?id=10295
43ERROR

Rotating the Emulator on a Mac is Fn-Ctrl-F12, not just Ctrl-F12 as it is on Windows computers.

2010-08-09
79,81ERROR

Dear Hello Android 3e Support:

I clicked the hyperlinks for the Game.java (.PDF Pg 79) and PuzzelView.java (.PDF Pg 81) files and added them to the org\\example\\sudoku folder. The PuzzleView.java code contained a “R.animn.shake cannot be resolved” error and the Game.java code contained a “Keypad cannot be resolved to a type” error. I did not modify the code, but copied it directly from the server. How do I fix these errors? Am a asking in the proper place? If not, please direct me to the right venue. Thanks and kind regards,

David Bailey

2010-08-17You should ask this on the book forum, http://forums.pragprog.com/forums/152 . But the answer is, the source code on the server reflects the final version at the end of the chapter. The shake animation is added a few pages later in the chapter (page 93).
66-67TYPO

in startGame() on page 66 we use intent.putExtra but it refers to .putExtra as extraData on page 67.

2010-08-17This is correct. The putExtra() method is the way you put things in the extraData area.
86TYPO

In the isValid function there is “for ( int t : useds)” and in the text it refers to the “used” array, without the “s”.

2010-08-17Thanks for the catch.
75TYPO

canvas.drawTextOnPath(QUOTE, circle, 0, 20, tPaint);

tPaint should be cPaint

2010-08-18tPaint is correct because tPaint and cPaint are intended to be different colors you set up for the text and circle, respectively.
00SUGGEST

The context class is used in a lot of code, but I don’t see any explanation of what it is and what it does. Maybe a short description of this would be good?

2010-08-18Usually it just means the current activity. There's an entry for it in the index, but you're probably right I should explain it better.
53TYPO

Third line in method onCreateOptionsMenu(Menu menu) is:

inflater.inflate(R.menu.menu, menu);

It should be:

inflater.inflate(R.layout.menu, menu);

2010-08-25R.menu.menu is correct as long as you put your menu.xml file in the res/menu directory as recommended.
84SUGGEST

Major Grid Lines part of the code

should it not be i % 3==0 (so two dark lines at 3 and 6 cell?)

when its i % 3 !=0 draws to many black lines.

2010-08-25It's right the way it is, because the expression says "if (i % 3 != 0) continue;". So if i is 1, 2, 4, 5, 7, or 8 then it will do a continue which skips the rest of the loop, and will NOT draw the line. If i is 0, 3, or 6 then it WILL draw the line.
62SUGGEST

In many places in the book (PDF version), there are references to pictures like “see something like Figure 3.8, on page 62.”. Many times, the picture itself is unrelated to the text that surrounds it, the best example I could find is Figure 3.8 on page 62, that happened to be inserted within the “3.6 Applying a Theme” section. Also, it requires the user to jump pages. It would be much nicer if the figures were as close to the text as possible.

2010-10-31The layout editor tries to get the pictures as close to the text as he can, but it's not always possible because we also want to keep page breaks out of example code, prevent widowed lines, and so on. I'll point these out to the editor to see what he can do.
118SUGGEST

On page 118, in the Music class, the stop() method takes a Context parameter that is never used. Maybe it would make sense to remove it from there?

2010-08-25It's harmless and I left it that way so it would be consistent with play(). I went through several implementations when writing the code, some of which used the parameter and some that didn't, before settling on that one. So leaving the parameter has another advantage of letting you change the implementation without changing the interface for other code that calls it.
118SUGGEST

The about window is an activity, so when it is shown, the music for the main activity stops playing. Maybe there is a way to create a more robust version of the player that doesn’t stop / start on these activities changes?

2010-08-25There isn't a real simple way to do that and I didn't want to needlessly complicate the example.
125SUGGEST

The “onRestoreInstanceState” method has an empty return statement that basically does nothing and serves no purpose. Maybe it could be removed?

2010-10-31
78SUGGEST

The code at the bottom of the page, the one that starts the game, passes ‘Sudoku,this’ as the context parameter, whereas it is enough to pass ‘this’. This must be some remainder from when the startGame method was inside the click listener or something. Anyways, it doesn’t serve any purpose now and I think it can only confuse Java newbies. The same code is in the attached sources.

2010-10-31
80SUGGEST

On page 80, in the Game.java class, there is no need to initialize the puzzle array as it will be overwritten anyways by the result of the call to getPuzzle() in onCreate().

2010-10-31
100ERROR

The comments on lines 3 and 11 of the calculateUsedTiles method need to be swapped, and the paragraph on pages 100-101 explaining the code has them backwards. In the first ‘for’ loop x is constant, so we’re checking for used numbers in the vertical column as y changes instead of horizontal as the book explains. The second ‘for’ loop is checking horizontally.

2010-10-31Good catch, thanks.
14SUGGEST

Section 1.4, “Running on a Real Phone”, should state that you may need to adjust the SDK platform version of the Hello, Android application to match the one on the phone being used. You may also need to adjust the “Min SDK Version”. This chapter is using Android 2.2. A real phone may have an earlier version installed on it, and it may be useful to quickly cover how to check the phone for its installed version and how to quickly change the Eclipse Project properties to reflect what is on the phone.

2010-10-31Added a sentence in the second printing for this.
58TYPO

The first sentence on page 58 is missing a word. It says “…view it in a couple ways.” instead of “…view it in a couple of ways.”

2010-10-31
60ERROR

The download link for Sudoku.java on page 60 of the PDF appears to have been swapped with the one on page 65.

The link on page 60 includes code to support the Options menu but e.g. res/menu/menu.xml has not been created yet; will be by page 65.

Hope this makes sense.

2010-10-31That was on purpose. The download links go to the working version as it will exist at the end of the chapter. Having only a few working versions helps me to ensure the correctness of the examples.
Chp 4TYPO

throughout the book it references Sudokuv[0…]/src/org/example/sudoku/…

I take it the [0…] represents separate projects.

The problem is each version is built upon a continuation from the original project. Isn’t this an error?

Thanks.

2010-10-31It's not an error. The downloadable examples have 5 different versions of the Sudoku project so that you can compare your version with a working version at several points in the development of the game.
276TYPO

The sentence in the first bullet point after 14.5 has ‘made’ when it should have ‘make’.

“You can make a paid app free, but you can’t made a free app paid.”

2010-10-31
98TYPO

The sentence “We call the PuzzleView.setSelectedTile() method…” in page 98 should be “We call the puzzleView.setSelectedTile() method…”

2010-10-31It's supposed to be that way. PuzzleView with a capital P refers to the class name. This is the way it would appear in the IDE and in Javadoc.
54TYPO

In the grey highlight box the path to the file is given as:
Sudokuv1/src/org/example/sudoku/Prefs.java
it should be:
Sudokuv1/src/org.example.sudoku/Prefs.java

2010-11-08Sudokuv1/src/org/example/sudoku/Prefs.java is correct
2814SUGGEST

For developers using Ubuntu Linux, additional set up is required to allow the Eclipse ADK to talk to an attached Android device.

A .rules file is required (or must be edited) so that udev can make the Android device available to the Android Debug Bridge (adb). For instance, /etc/udev/rules.d/99-android.rules

Important to note that the official Android SDK website is out-of-date regarding this. Advise use of the lsusb command to identify the VendorID of the Android device.

Example .rules file record for NexusOne:
SUBSYSTEM"usb", ATTR{idVendor}“18d1”, MODE=“0666”

Some explanation of udev and adb would help readers understand the purpose this set up, such as the numbered prefix of the .rules file (how it affects the load order of rules by udev).

2011-01-24I'm not set up to test those instructions and make sure they stay up to date, so I don't feel comfortable adding them to the book. It's unfortunate that even the website is out of date so I suggest you file a bug report at b.android.com to have the the site fixed. That way when I refer people to the site they can get the correct info for their system.
182ERROR

private static final String DATABASE_NAME = “events.db”;
The “events.db” may cause a SQLiteException,
when change it to “events”,it will pass.

2011-01-24I cannot reproduce this problem in the emulator or on any of my phones. If somebody can help me reproduce it then I'll reopen it.
100ERROR

Actually, the horizontal line should be x-axis in the screen, so I guess in calculateUsedTiles() method, what the codes do is to traverse from vertical to horizontal.

2010-12-02
86ERROR

In two places on this page, I’m guessing you must have changed the keypad from being a separate activity (in a previous version of the book maybe) to being a dialog within the game activity, without completely updating the text to match this new approach.
Anyway, you say: “Now that we have the activity, let’s call it in the Game class…”. I think this should read: “Now that we have the dialog class implementation, let’s call it in the Game class…”.
And at the bottom of the page you say: “we pass the Keypad a string in the extraData area containing…”. But it isn’t a string and it isn’t in the extraData area. I think this should read: “we pass the Keypad an array containing…”.

Best regards, John

2011-01-24
74SUGGEST

Hello, I am actually working with P3.0, November 2010, but there wasn’t an option in the pull down list on this page.

On page 74, the line that includes getTileString(i,j) causes a Force Close when the app is run. The problem is that that Chapter 4 is one big text entry fest (for those of us actually entering code as we go). There is no point where the reader is directed to try to run the code. So, when I got to the D-pad code, I was getting nervous and tried to run the app. Only then did I discover the Force Close error. I had no idea which part of the code caused the error, so I took your advice and used the LogCat window. I discovered that it was the canvas.drawText line and figured out that getTileString was causing the problem. I then saw the note about how getTileString is defined in Section 4.4 on page 81. Turns out getTileString is defined at the very end of 4.4 on page 90. After entering getTileString, I then had to enter other methods it depended on like getTile and then fromPuzzleString, getPuzzle and the 3 puzzle strings.

Up until Chapter 4, the book is paced well for a beginner. Chapter 4 is like the bronco that almost bucked me. It would have been nice to have given the reader the chance to run the code a few times throughout the chapter. That also implies that required code would be entered prior to running. I’ll admit that I felt good after figuring things out, but some readers might be put off by the scavenger hunt I had to go on. FYI.

2011-01-24I enhanced the cross-references so that readers can find the non-graphics methods like getTileString more readily. Also I added a paragraph at the beginning of the chapter explaining what's going on. This should eliminate the "scavenger hunt".
129ERROR

The layout that is supposed to create a WebView with a button and textbox above it, does not work properly on my Droid X. Instead, all I get is the WebView. I am using the code from this web site. FYI.

2011-01-24I tried it in the emulator and on a Nexus One, Droid 1, and Evo 4G and was unable to reproduce.
65SUGGEST

pls include a or state to create a new class prefs

2011-01-24Sorry, I don't understand this suggestion and I can't tell who made it. If you made it, please rephrase the suggestion and resubmit it. Thanks.
57SUGGEST

When the exit button doesn’t fit in landscape view it also doesn’t fit on low density screens in portrait view.
Although its easily fixed by copying the main.xml from layout-land into a layout-ldpi folder.Just thought you might wanna mention that in the book.

2011-01-23
74SUGGEST

I would like to suggest the use of stub methods during the whole of Chapter 4, where a method call is introduced that calls functionality that has yet to be included. The use of the Eclipse “Quick Fix” feature can generate the skeleton of these methods. Some tweaking may be required to return a meaningful value, but it is fairly minimal. The great advantage would be that the reader can run the app at a number of points during Chapter 4.

Without this, the reader has a long slog to enter all the code before the app is runnable at the very end of the chapter. I realise that the app can be downloaded from the web, but some readers are using this as a learning exercise for Java coding and Eclipse, and will want to enter the code for themselves.

Up to the end of Chapter 3, there are several points at which the app can be run. It would be great if the use of stub methods could be included in the book for Chapter 4.

2011-01-24Instead of stub methods I enhanced the cross-references so that readers can find the non-graphics methods more readily. Also I added a paragraph at the beginning of the chapter explaining what's going on. I hope this will strike a good balance for people who are just reading vs. people who are typing in all the code.
83SUGGEST

When drawing background color use
canvas.drawColor(getResources().getColor(R.color.puzzle_background)); as this uses one line of code(Method) instead of two and takes less arguments so its less confusing to a beginner.

2011-01-23It would be simpler, but it would introduce a new method that is not used elsewhere so I think I'll leave it the way it is.
48TYPO

In the second paragraph, the sentence, “We’re passing it the this variable, so we had better make the current class (Sudoku) implements that interface, or we’ll get a compiler error.” does not read correctly.

I suspect the word, “sure” is missing after “make”, as in “we had better make sure”.

The other possibility I can see is it was supposed to read “… better make the current class (Sudoku) implement that interface…” - in this case, the error would be that implements is the wrong verb agreement with the noun.

2011-01-23
42ERROR

Running on Windows 7 required using Fn+Ctrl+F11 to cause emulator display to switch to alternate layout. Text would suggest that this is only applicable to Mac.

John Webster (hikect@sbcglobal.net)

2011-01-24Windows keyboards don't have a Fn button, so I emailed JW for clarification.
61ERROR

Instead of “about_title”, needs to be “about_label”.


// AS SEEN IN PDF: android:label=“@string/about_title”>

2011-01-23
103TYPO

The changes to AndroidManifest.xml incorrectly highlight (in bold) several lines which are not changed, while the new line of code to be added is not highlighted,
android:theme=“@android:style/Theme.NoTitleBar.Fullscreen” >

2011-01-24There's a known bug in the publisher's formatting tools. The bolding is supposed to be syntax highlighting (not change highlighting) but it doesn't always work if the starting and ending tags are not on the same line. I've reported it several times to the publisher but so far they haven't been able to fix it.
5ERROR

In the sentence before heading “Android SDK Components” it is recommended that the PATH be updated to include the “tools” folder of the installed Android SDK. The same recommendation should be made for the “platform-tools” folder, since this is required when running the adb tool, e.g. on page 101 where “adb push” is used in the Video example.

2011-01-23
5SUGGEST

While working through the “Hello, Android” book I’ve taken the opportunity to gain experience with Ubuntu Linux. Coming from a Windows background, even little things like adding a folder to the PATH environment variable can be a challenge (or at least a distraction). In my case I needed to use the command “sudo gedit /etc/environment” and add the path to the colon-delimited list. If this would get in the way within the main line of the book, on page 5, perhaps an Appendix could be added, or a link to the book’s web page.
I know this may be outside the scope of the book, but I am probably not a unique case; adopting Ubuntu as a preferred dev platform seems a natural step in parallel to moving to Android development. Both are open platforms and complement each other. Also, tools such as Git are well suited to Ubuntu devs. Great book, btw :)

2011-01-24I don't feel comfortable adding instructions in the book for systems that I don't use on a daily basis. Also the Linux and Mac folks seem to be tech savy enough to figure out things like that on their own, as you did. So I think I'll leave it for now.
61SUGGEST

My mistake; Not A Problem. (sorry!) I’d missed putting in “about_title” as seen on page 58.

2011-01-23
185TYPO

Try{
addEvent(“Hello, Andorid!”); // this should be addEvents
Cursor cursor = getEvents();
ShowEvents(cursor);
}

2011-01-30addEvent() is correct. There is no addEvents() method.
55SUGGEST

My title wasn’t properly centering; it was left adjusted. It appears that the TextView for @string/main_title has its layout_gravity set to centered; this (from what I’ve read) would seem to center the control rather than the text. Should you have android:gravity=“center” as well?

2011-03-04No, it's correct the way it is. android:layout_width is set to "wrap_content" on that TextView so there is no wiggle room in which to center the text inside the TextView. Instead, the entire view is centered within its layout using android:layout_gravity="center". \n \nThere are other, possibly better ways to get the same look so there's no special reason that I did it that way.
135ERROR

In the second to last para of section 7.1, “The next line creates a new Intent class with an action of ACTION_VIEW,
passing it the Uri class just created as the object we want to view.” the word “class” is used twice when referring to instances of those classes.

2011-03-04
38TYPO

Page 38 lists the filename of the code block printed is main1.xml, shouldn’t it be main.xml?
Thanks!

2011-03-04Good catch, thanks.
226SUGGEST

Hi Ed, reading your “Helllo, Android”, 3rd edition, was mostly fun but still conveying lots of information — thanks a lot!
I’d just like to mention that the sample code for the Multi-Touch chapter better had not used the raw MotionEvent handling model but the more advanced GestureDetector (since API Level 1; for dragging via OnScroll()) and ScaleGestureDetector (since API level 8; for zooming) classes. I stumbled over these when I was adding (or, actually, had already added) a double-tap handling to restore the untransformed view.
On the other hand I appreciate your recommendations on the support of multiple API levels (pp. 256 ff.) which build upon the handling of exactly the MotionEvent … Anyway, your book was an excellent read and I’m now ready to dig somewhat deeper into the Android’s universe ;)
Kind regards, Manfred

2011-03-04Thanks. I thought about using the gesture detectors but decided not to because I wanted to support all versions of Android from 1.5 forwards.
72TYPO

In the code for drawing the major grid lines, there appears to be an error in the line:
if (i % 3 != 0)…
in this case, the heavy line will be drawn for the opposite of the intended case. by switching this to only draw the line when i mod 3 equals 0 (i % 3 == 0) then the issue seems to be resolved.

Thanks,

Brad

2011-05-16It is correct as written. It says "if (i % 3 != 0) continue;" which means it will skip drawing the dark line for values of 1, 2, 4, 5, 7, and 8.
244TYPO

android:author=“+string/author" should just be android:author="string/author” without the ‘+’

2011-06-23Confirmed error. Seems to be harmless though.
246TYPO

There’s a semicolon after the closing brace of the onDestroy() method

2011-06-23Confirmed error. Seems to be harmless though.
50TYPO

Theme.Dialog

should be

Theme_Dialog

2011-05-16No, in XML the period is correct as written. See http://d.android.com/guide/topics/ui/themes.html#ApplyATheme which says: \n \n android:theme="@android:style/Theme.Dialog"
50SUGGEST

When I do the “correct” change to Theme_Dialog is get an error in Eclipse but when I used Theme.Dialog it works without a problem. Yes I do know that this is contradictory to the android documentation.

2011-05-16In XML the period is correct. See http://d.android.com/guide/topics/ui/themes.html#ApplyATheme which says: \n \n android:theme="@android:style/Theme.Dialog"
43TYPO

<TextView
………
android:layout_gravity=“center” should that be android:gravity=“center”

Also the web page for the errata “Version” gives an option of 2011-04-11 ….. P6.0
The book gives a different date for P6.0; 2011-3-24

2011-06-23Either way works as long as you use them consistently. layout_gravity="center" means center this view in the parent, but gravity="center" means center the contents of this view. \n \nMy guess on the date is that the publisher sent it to the printers on 24apr and it came back on 11may. But in any case there was only one 6th printing.
101ERROR

What is the location of the /data folder containing the samplevideo.3gp file?
Thanks!
Receiving message ‘Cannot play video’

2011-09-29You can only access the /data folder if you are using the Emulator. Try /sdcard or /mnt/sdcard as described later in the book.
40SUGGEST

The text does not seem to explain why suddenly there are nested elements in the code displayed on pages 40-42. I edited the code gradually, putting the padding, color, and text size (and centering) modifications in the single default LinearLayout, and without adding the enclosing LinearLayout I could still see the results dsiaplyed in Figure 3.4.

2011-12-15You're right, I'll simplify it in the next version.
49ERROR

I had trouble adapting the activity xml declaration for my own project, where it has “.About” in the sudoku example. I found I needed the whole string eg. “com.example.android.myapp.myActivity”. This was a pernicious error as it wasn’t caught by the spell checker (Eclipse Helios) and took me ages to hunt down!

2011-12-15You just need the part after your package name as declared in AndroidManifest.xml. For example if you declare your package name as "com.example.android" and your activity's class name is "com.example.android.myapp.myActivity" then you can specify the activity using the whole string or abbreviate it to ".myapp.myActivity". All the Google examples and wizards use the abbreviated version. I'll add a note about it in the next revision.
48ERROR

I am using Eclipse Platform\t3.7.1.r37x_v20110729-9gF7UHOxFtniV7mI3T556iZN9AU8bEZ1lHMcVK. It gave me a compiler error when I typed in the onClick() member function in Sudoku.java. Apparently this version of the compiler is insistent on using the @Override in front of the function definition.

2011-12-15It depends on your Eclipse settings. If you use the 1.5 Java compiler compliance level, then putting the @Override there always gives an error. If you use the 1.6 level then it's optional and can be controlled in the Preferences window under Java > Compiler > Errors/Warnings > Annotations > Missing '@Override' annotation > Include implementations of interface methods (using Eclipse 3.7).
67SUGGEST

At the bottom of page 67 in the paper book, the “Defining the Game Class” section starts at the very bottom of the page in the space that is normally reserved for footnotes. Not sure if this was by design of if it was intentionally placed there.

2012-01-13In the next printing, that section starts a paragraph down on p. 64. So looks like we're okay there.
35ERROR

The generated code for initial resources produced by Eclipse (Version 3.7.1) creates “res/drawable*/ic_launcher.png”, not “icon.png”. This is also a problem with the first line of the code snippet on pg. 59 (and possibly later in the book). The downloaded version of the code uses “icon.png”. Either change the .png file names to “icon.png” or else change the code listed in the book from “icon.png” to ic_launcher.png". I did the latter and eliminated the problem.

2012-01-12A recent update to the Android Eclipse plug-in changed the name of the generate icon file. I've updated the 8th printing to reflect this.
59ERROR

File name conflict for res/drawable*/icon.png. See my comment for this problem listed for page 35.

2012-01-12A recent update to the Android Eclipse plug-in changed the name of the generate icon file. I've updated the 8th printing to reflect this.
133ERROR

Chaper 7 The Connected World:

7.1 Browsing by Intent
line 14 “public class BrowserIntent extends Activity” must implement OnClickListner and OnKeyListner.

2012-04-12No, those shouldn't be necessary. Why do you think so?
88SUGGEST

Audio — You have up to this point made the book standalone.
But I had to go to main.xml in your code to find the layout for the buttons. I think you should have included them by showing main.xml or said that you meant to omit them.
But that they should go in the main.xml and look somewhat like the buttons in Suduko keypad.xml by renaming keypad_1 to button_1. Thank you — an excellent book !!

2012-04-12Thanks for the report; I believe we fixed all the cases like this in the more recent printings.
8ERROR

On the bottom of the page it says “OK, that takes care of writing the program;” however the program was never written. We have just created a new and empty project. The HelloWorld code is nowhere and there was no further mention of the built-in example program mentioned on the top of the page

2012-04-12The New Android Project wizard (File > New > Project > Android > Android Project) too care of writing the program for us. It's not quite empty - when you run it, it should show one line of text on the screen as seen in Figure 8 (Running the "Hello, Android" program). If you really got an empty project then you probably did File > New > Project > General > Project instead. Try it again and pick the Android project. If you still have trouble ask on the book forum.
52TYPO

On page 52 in edition 3 the ID (settings)for the item does not register with the Eclipse ADT plug-in. I am not sure if this is a result of my fault or of the book’s fault, but I have checked over my work many times.

52ERROR

regarding the issue #4953 - that the Settings ID tag does not register in eclipse. I found that by taking out the … the id registers. The … apparently throws eclipse off.

135ERROR

The discussion thread on this book headlined Browser Intent and Browser View problems details my problem in that some code from the tutorial at Section 7.1 needs to be included into the projct at Section 7.2 in order for 7.2 to work. Specifically I beleive that it is the line of code: urlText = (EditText) findViewById(R.id.url_field); needs to be included.
An alternative to that would be to explicitly tell readers that most of the code should e recycled for the project at 7.2.
Hope that helps.

99TYPO

The 1st line in subchapter “6.1 Adding Options to Sudoku”:
“…we used the onCreateOp-tionsMenu()…”. Should be onCreateOptionsMenu() without ‘-’.

121TYPO

Lower part of the page: “the window.an-droid object.” should be without ‘-’.

118SUGGEST

Example from ch. 7.3 From JavaScript to Java and Back

This example does not work with 2.3 emulators. I tested it with emulator 2.3.3. Problem was reported, see discussion from book forum forums.pragprog.com/forums/152/topics/9720. I also tried it with emulator 3.1 and it works.

This is just a reminder to add some footnote if there is an update of the book.

52ERROR

The button tags in the new layout presented use different string ids than what was previously entered. strings.xml contains continue_label and the like, as does the original layout earlier in the chapter. However, the new layout refers to @string/continue_button, and so on, which is inconsistent.

39TYPO

You need to create res/layout-land/activity_main.xml, not res/layout-land/main.xml

138ERROR

The source code for the Translate Client seems to be missing from gz as well as zip archive.

2013-04-13The Translate example stopped working when Google removed the service, so the example had to be replaced with the Suggest example.
160ERROR

I followed everything correctly but I keep getting the “translation error”, I also tried to find the source code, but had no luck with that. Could you tell me if this code is out of date or not??

Thanks in advance,
Greeting Christiano Bolla

9SUGGEST

With upgrade in ADT v22.1 the activity needs to be created separately instead of just new project. Also there is no option for NewAndroid>Andoid Project. You have sample project or new application project.
The default layout now is relative layout.

65SUGGEST

i have pdf version 2010-7-16
on this page under section 3.8(adding settings) there is a statement “You define
the preferences in a resource file called res/xml/settings.xml”
IAm using adt version 21.1.0. Also iam creating the sudoku app for 4.2.2 JB. Here in the directory structure there is no folder named ‘xml’. Where to create the setting.xml file? Iam Stuck here.. Iam i wrong somewhere??

66TYPO

addPreferencesFromResource method cannot be used as it is deprecated..
what is the alternative for this?plz help

99TYPO

in the section 6.1. The method name onCreateOptionMenu has a dash, I supose it comes from previous versions.

50SUGGEST

in the override of the OnCreate method for class Prefs you call a method addPreferencesFromResource which has been deprecated (in APIv11). It talks about a new “fragment based preference activity” in the developer reference. It would be lovely if you had an update for this section.

122ERROR

The “callAndroid” method needs a @JavascriptInterface annotation, or else the code won’t compile. More info about that annotation/error can be found on the Android docs. The specific error Eclipse cites is:

None of the methods in the added interface have been annotated with @android.webkit.JavascriptInterface; they will not be visible in API 17

Categories: