Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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?
Reply With Quote
  #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;
Reply With Quote
  #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?
Reply With Quote
  #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
Reply With Quote
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.
Reply With Quote
  #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?
Reply With Quote
  #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
Reply With Quote
  #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).
Reply With Quote
  #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.
Reply With Quote
  #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!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.