Wrox Programmer Forums Problem: Chapter 8 "Mapping Earthquakes Example" (Page 282)
 |
BOOK: Professional Android 2 Application Development
 This is the forum to discuss the Wrox book Professional Android 2 Application Development, 2nd Edition by Reto Meier; ISBN: 978-0-470-56552-0 Read more about Professional Android 2 Application Development, 2nd Edition or buy the book from your favorite retailer Download the code for Professional Android 2 Application Development, 2nd Edition
 Welcome to the p2p.wrox.com Forums. You are currently viewing the BOOK: Professional Android 2 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com

June 18th, 2010, 02:31 AM
 DrGaribaldi Authorized User Join Date: Jun 2010 Posts: 18 Thanks: 0 Thanked 6 Times in 3 Posts
Problem: Chapter 8 "Mapping Earthquakes Example" (Page 282)

In Step 5.2, which shows the implementation of the refreshQuakeLocations() method, contains the following code:

Code:
```Double lat =
earthquakes.getFloat(EarthquakeProvider.LATITUDE_COLUMN) * 1E6;
Double lng =
earthquakes.getFloat(EarthQuakeProvider.LONGITUDE_COLUMN) * 1E6;

GeoPoint geoPoint = new GeoPoint(lng.intValue(),
lat.intValue());```
However, looking at the API documentation for GeoPoint ( http://code.google.com/android/add-o.../GeoPoint.html ) I see that the parameters to the constructor are (latitude, longitude) not (longitude, latitude).

The code should be updated as follows:

Code:
```GeoPoint geoPoint = new GeoPoint(lat.intValue(),
lng.intValue());```
The code on the publisher's web site also contains this error.

June 18th, 2010, 03:00 AM
 DrGaribaldi Authorized User Join Date: Jun 2010 Posts: 18 Thanks: 0 Thanked 6 Times in 3 Posts
Problem: Chapter 8 "Mapping Earthquakes Example" (Page 281)

Also, in Step 5.1, the signature for EarthquakeOverlay constructor is:

Code:
`public EarthquakeOverlay(Cursor cursor, ContentResolver resolver)`
However, in Step 6 when an instance of the EarthquakeOverlay class is instantiated, the code shows:

Code:
`EarthquakeOverlayou eo = new EarthquakeOverlay(earthquakeCursor);`
Note that only one parameter is passed to the constructor. Looking at the code available on the publisher's web site, I see the constructor signature has been updated to read:

Code:
`public EarthquakeOverlay(Cursor cursor)`

June 18th, 2010, 03:10 AM
 DrGaribaldi Authorized User Join Date: Jun 2010 Posts: 18 Thanks: 0 Thanked 6 Times in 3 Posts
Problem: Chapter 8 "Mapping Earthquakes Example" (Page 283)

Also, in Step 6, the earthquakeURI variable is declared to be of type String:

Code:
`String earthquakeURI = EarthquakeProvider.CONTENT_URI;`
However, the type of EarthquakeProvider.CONTENT_URI is Uri (android.net.Uri).

The code on the publisher's web site reflects this change.

July 29th, 2010, 06:24 PM
 dbomberg Registered User Join Date: Jan 2009 Posts: 3 Thanks: 0 Thanked 0 Times in 0 Posts

Quote:
 Originally Posted by DrGaribaldi Also, in Step 6, the earthquakeURI variable is declared to be of type String: Code: `String earthquakeURI = EarthquakeProvider.CONTENT_URI;` However, the type of EarthquakeProvider.CONTENT_URI is Uri (android.net.Uri). The code on the publisher's web site reflects this change.
Thank you DrGarabaldi, please keep those fixes coming!

 Similar Threads Thread Thread Starter Forum Replies Last Post Problem: Chapter 7 "Saving Your To-Do List" (Page 218) DrGaribaldi BOOK: Professional Android 2 Application Development 2 March 21st, 2011 01:53 AM Problem: Chapter 7 "Creating and Using an Earthquake Content Provider" (Page 232) DrGaribaldi BOOK: Professional Android 2 Application Development 0 June 17th, 2010 04:07 AM Big problem discovered at page 58 "Creating Simple Links" Antares BOOK: Beginning HTML, XHTML, CSS, and JavaScript 6 February 23rd, 2010 07:25 PM How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM