You can use getApplicationContext() or current class.this (means if your
class name is Abc then use like this Abc.this)
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Bret Foreman
Sent: Friday, July 02, 2010 10:32 PM
To: Android Beginners
Subject: [android-beginners] Re: Unable to start service
Intent.setClass needs a Context for the first argument. Replacing
cb.getContext with "this" causes a compiler error. Do you mean I should
call getApplicationContext?
Here's the full trace:
com.shipmate.MainActivity [Android Application using Studio for Android]
DalvikVM[localhost:8610]
Thread [<3> main] (Suspended (exception
RuntimeException))
ActivityThread.handleCreateService(ActivityThread
$CreateServiceData) line: 2764
ActivityThread.access$3200(ActivityThread,
ActivityThread
$CreateServiceData) line: 119
ActivityThread$CreateServiceData(ActivityThread
$H).handleMessage(Message) line: 1917
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4363
Method.invokeNative(Object, Object[], Class,
Class[], Class, int,
boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 860
ZygoteInit.main(String[]) line: 618
NativeStart.main(String[]) line: not available
[native method]
Thread [<13> Binder Thread #2] (Running)
Thread [<11> Binder Thread #1] (Running)
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en