Wrox Programmer Forums
|
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
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
 
Old May 7th, 2010, 06:06 AM
Registered User
 
Join Date: May 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Bug: Code Example Chapter 10 Earthquake 3

Bug: Code Example Chapter 10 Earthquake 3

05-07 10:00:31.243: ERROR/AndroidRuntime(346): java.lang.RuntimeException: Unable to get provider com.paad.earthquake.EarthquakeProvider: android.database.sqlite.SQLiteException: near "link": syntax error: create table earthquakes (_id integer primary key autoincrement, date INTEGER, details TEXT, latitude FLOAT, longitude FLOAT, magnitude FLOAT) link TEXT);

Solution:
In the class EarthquakeProvider:
Line 230, remove the ')' to fix the bug
 
Old January 12th, 2012, 05:03 PM
Registered User
 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default the SQL appears to have moved a bit (line numbers)

in EarthquakeProvider.java
see:
private static class earthquakeDatabaseHelper extends SQLiteOpenHelper {
private static final String DATABASE_CREATE =
"create table " + EARTHQUAKE_TABLE + " ("
+ KEY_ID + " integer primary key autoincrement, "
+ KEY_DATE + " INTEGER, "
+ KEY_DETAILS + " TEXT, "
+ KEY_LOCATION_LAT + " FLOAT, "
+ KEY_LOCATION_LNG + " FLOAT, "
+ KEY_MAGNITUDE + " FLOAT), " <<<< the ")" shouldn't be there
+ KEY_LINK + " TEXT);";

Fixed fragment:
private static class earthquakeDatabaseHelper extends SQLiteOpenHelper {
private static final String DATABASE_CREATE =
"create table " + EARTHQUAKE_TABLE + " ("
+ KEY_ID + " integer primary key autoincrement, "
+ KEY_DATE + " INTEGER, "
+ KEY_DETAILS + " TEXT, "
+ KEY_LOCATION_LAT + " FLOAT, "
+ KEY_LOCATION_LNG + " FLOAT, "
+ KEY_MAGNITUDE + " FLOAT, "
+ KEY_LINK + " TEXT);";


Also requires a reference (for local Eclipse build) to Google APIs: maps.jar





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to run code chapter 9, 10, 13 ttdevelop BOOK: Professional Android 2 Application Development 17 December 7th, 2012 05:14 PM
Is there code example for chapter 10 - Web Parts? krahman01 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 April 16th, 2010 07:54 PM
Chapter 10 code errors in the book GranDad BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 January 26th, 2007 12:25 AM
Chapter 10 Sample Code jramkawsky BOOK: Professional Java Development with the Spring Framework 0 December 3rd, 2005 08:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.