Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old August 17th, 2010, 01:44 PM
Authorized User
 
Join Date: Jul 2010
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Default Chapter 9 Earthquake 1

The Eclipse editor is telling me that it cannot resolve the Service.START_STICKY in the following code in the EarthquakeService Class:

Code:
   return Service.START_STICKY;
Any suggestions?
  #2 (permalink)  
Old August 17th, 2010, 01:47 PM
Registered User
 
Join Date: Aug 2010
Posts: 13
Thanks: 1
Thanked 2 Times in 2 Posts
Default Is your import correct?

import android.app.Service;
  #3 (permalink)  
Old August 17th, 2010, 01:55 PM
Authorized User
 
Join Date: Jul 2010
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Default

I have that in the import section yes:

Code:
import android.app.Service;
Any idea what else it could be?
  #4 (permalink)  
Old August 17th, 2010, 02:25 PM
Registered User
 
Join Date: Aug 2010
Posts: 13
Thanks: 1
Thanked 2 Times in 2 Posts
Default API Level?

What Android API Level are you using? Project Properties...Android...Project Build Target

START_STICKY was introduced at API Level 5
The Following User Says Thank You to juniper For This Useful Post:
MellowFellow (August 17th, 2010)
  #5 (permalink)  
Old August 17th, 2010, 02:40 PM
Authorized User
 
Join Date: Jul 2010
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks again. I was building in API Level 3. Its no longer giving me that problem.
When I run it now it gives the following error:

WARN/dalvikvm(499): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-17 14:00:47.341: ERROR/AndroidRuntime(499): FATAL EXCEPTION: main
08-17 14:00:47.341: ERROR/AndroidRuntime(499): java.lang.RuntimeException: Unable to start service com.paad.earthquake.EarthquakeService@43e6ccf0 with Intent { cmp=com.paad.earthquake/.EarthquakeService }: java.lang.ClassCastException: java.lang.String
08-17 14:00:47.341: ERROR/AndroidRuntime(499): at android.app.ActivityThread.handleServiceArgs(Activ ityThread.java:3063)

I'm using the code downloaded from this site.
  #6 (permalink)  
Old August 17th, 2010, 03:31 PM
Registered User
 
Join Date: Aug 2010
Posts: 13
Thanks: 1
Thanked 2 Times in 2 Posts
Default JDK

what JDK are you using?
  #7 (permalink)  
Old August 17th, 2010, 03:35 PM
Authorized User
 
Join Date: Jul 2010
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Default JDK Version

I'm using JDK 1.6.0_20
  #8 (permalink)  
Old August 17th, 2010, 04:10 PM
Registered User
 
Join Date: Aug 2010
Posts: 13
Thanks: 1
Thanked 2 Times in 2 Posts
Default API Level

What API Level are you using now? It's working for me with 7 (2.1-update).
  #9 (permalink)  
Old August 17th, 2010, 04:27 PM
Authorized User
 
Join Date: Jul 2010
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Default API Level

I'm using API level 7 as well now, but its not working. I'll have to copy the code again and re-try it. Thanks for the help.
  #10 (permalink)  
Old August 18th, 2010, 08:06 AM
Authorized User
 
Join Date: Jul 2010
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Default Working File

I re-did it from scratch as a new project in API 7. It is now working!




Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 7 Earthquake 2, Earthquake.java, error onActivityResult dbomberg BOOK: Professional Android 2 Application Development 2 November 30th, 2012 05:52 AM
Please help: Chapter 9 Earthquake 4 dahe BOOK: Professional Android 2 Application Development 0 July 21st, 2010 03:41 PM
chapter 5 Earthquake EricTapia BOOK: Professional Android 2 Application Development 2 April 14th, 2010 12:47 AM
Chapter 8 Earthquake Notification woods620 BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 1 December 23rd, 2009 09:57 AM
Chapter 6 Earthquake using Provider abowman BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 0 March 9th, 2009 05:19 PM





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