Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 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 January 27th, 2009, 10:29 PM
Registered User
 
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Earthquake Example problem "non-application token"

I'm trying to run the Earthquake example from chapter 8, the v4 version.
And after I fixed the "vibrate permission problem", now in the emulator, when I select one of the earthquakes, the application has an "stopped unexpectedly". When I look in the debugger view of Eclipse, I can see that there was an uncaught exception related to a bad token "token null is not set for application"

Which in turn seems like it was caused by "Attempted to add window with non-application token WindowToken{434538d8 token=null}. Aborting."

Any ideas? This is running in the latest version of the emulator, running on linux/ubuntu (gutsy) with jdk1.6 and eclipse ganymede.

Thanks in advance for any pointers.
 
Old January 27th, 2009, 10:41 PM
Registered User
 
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Found the problem... the book was right

There are a couple of lines that are correct in the book but "wrong" in the downloadable example code.

In Earthquake.onCreateDialog()
change:
LayoutInflater li = LayoutInflater.from(getApplicationContext());
to
LayoutInflater li = LayoutInflater.from(this);

and
AlertDialog.Builder quakeDialog = new AlertDialog.Builder(getApplicationContext());
to
AlertDialog.Builder quakeDialog = new AlertDialog.Builder(this);
 
Old January 28th, 2009, 02:29 PM
Reto's Avatar
Wrox Author
Points: 287, Level: 5
Points: 287, Level: 5 Points: 287, Level: 5 Points: 287, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: London, United Kingdom
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
Default

Quote:
Originally Posted by Langley View Post
There are a couple of lines that are correct in the book but "wrong" in the downloadable example code.
Thanks for posting your findings, hopefully it'll help others who run into the same problem.

I'll update the downloads ASAP to reflect the corrections you've highlighted.

Thanks again!
__________________
Reto Meier

Author, "Professional Android 4 Application Development", Wrox, ©2012, 2010, 2008
@retomeier




Similar Threads
Thread Thread Starter Forum Replies Last Post
WebPart not supporting/enabled displaymode other than "Browse" amitjoshipune ASP.NET 2.0 Professional 1 January 9th, 2009 02:34 PM
google Response.Write(Request.QueryString("q")) senol01 ASP.NET 2.0 Basics 1 January 2nd, 2009 12:01 PM
pgs. 506-512 "r" ? Rachel BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 January 2nd, 2009 05:02 AM
replacing " gantait XSLT 1 March 4th, 2007 10:44 AM
Replace Character " fosca XSLT 1 November 11th, 2004 04:14 PM





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