On Sat, Jul 3, 2010 at 1:45 PM, Bret Foreman <bret.fore...@gmail.com> wrote:
> OK, so let me state where we stand at the moment. Current code to
> start service:
>
>                                        Intent myIntent = new Intent();
>                                        myIntent.setClass(MainActivity.this, 
> SensorService.class);
>                                        startService( myIntent );
>
> I have a breakpoint at the top of the onStartCommand method of
> SensorService and it's never getting hit.

Because your problem is in your constructor or initializer:

> E/AndroidRuntime(  221): Caused by: java.lang.NullPointerException
> E/AndroidRuntime(  221):        at
> android.content.ContextWrapper.getApplication
> Context(ContextWrapper.java:100)
> E/AndroidRuntime(  221):        at
> com.shipmate.SensorService.<init>(SensorServi
> ce.java:26)

Go to line 26 of SensorService.java. You are attempting to do
something there that cannot be done in a constructor or initializer.
Move that code to onCreate() of your service, and you should be in
better shape.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 2.2 Programming Books: http://commonsware.com/books

-- 
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

Reply via email to