Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning Android Application Development
|
BOOK: Beginning Android Application Development
This is the forum to discuss the Wrox book Beginning Android Application Development by Wei-Meng Lee; ISBN: 978-1-1180-1711-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Android 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 June 26th, 2012, 11:28 AM
Registered User
 
Join Date: Jun 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Chapter 6, Database Examples won't work on real device! Please help!

I cannot get any of the Database Try It Out examples presented from p225 onwards in Chapter 6 to work on my HTC Wildfire S device. Everything was going swimmingly up until now! I get the following dreaded message:

Sorry!
The application Databases (process com.baad.Databases) has stopped unexpectedly. Please try again.
Force close?

I am pretty sure the problem lies in the line:
Cursor c = db.getAllContacts(), but since I cannot find fault with that method (or any other for that matter) in the DBAdapter class I am at a loss.

Has anyone else experienced this problem? Do I need a uses-permission or something?

Please help! I have to write an application that uses my own database, so would really like to understand this example.

Thanks in advance!
Nick
 
Old June 27th, 2012, 08:46 AM
Registered User
 
Join Date: Jun 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Answered my own question!

OK, so if anyone else has problems with this, the solution is to change the line in DBAdapter.java from
private static final String DATABASE_NAME = "MyDB";
to
private static final String DATABASE_NAME = "MyDB.db";

... Simples! :)
 
Old June 27th, 2012, 08:50 AM
Registered User
 
Join Date: Jun 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Add this to Errata

I don't know if I can add this to the list of Errata myself? So if someone fancies doing it for me, the offending pages in the book are p219 and p221.

Thanks
Nick
 
Old July 2nd, 2012, 03:57 AM
Registered User
 
Join Date: Jun 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The author tells me that the database file extension should not be necessary, and indeed in a later example in the book can be ommitted without the program crashing. So I do not know why it fixed the problem I was having this time!?





Similar Threads
Thread Thread Starter Forum Replies Last Post
database problem wont work on real device androidev23 BOOK: Beginning Android Application Development 0 June 15th, 2012 08:34 AM
Unsure how to work with the Code examples leemark2k3 BOOK: Professional ASP.NET 4 : in C# and VB 3 March 6th, 2012 05:01 PM
Example will not work in the real world ElMorenito BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 2 October 12th, 2006 01:18 PM
Recommended setup to work thru the examples? kjullion BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 February 13th, 2006 12:44 PM
Ch 3 Examples Don't Work Gregorio BOOK: Professional Crystal Reports for VS.NET 3 February 15th, 2005 11:36 AM





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