On Fri, Jul 2, 2010 at 12:01 PM, Bret Foreman <bret.fore...@gmail.com> wrote: > I'm try to start a service like this: > > try { > Intent myIntent = new > Intent(); > > myIntent.setClass(cb.getContext(), SensorService.class); > startService( myIntent > ); > } catch( Exception e ){ > android.util.Log.e( > getString(R.string.app_name) , "Unable to > start sensor service" , e ); > }
Try replacing "cb.getContext()" with "this". > And I see a runtime exception like this: > > 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] That is not an exception. It is a stack trace. You are missing the exception part, and the "Caused by:" portion. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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 android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en