Hi I checked the debug log. This is the error i got. 07-07 10:58:00.210: ERROR/AndroidRuntime(273): Uncaught handler: thread main exiting due to uncaught exception 07-07 10:58:01.442: ERROR/AndroidRuntime(273): java.lang.RuntimeException: Unable to instantiate service com.satloc.PeriodicUpdationService: java.lang.NullPointerException 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at android.app.ActivityThread.handleCreateService(ActivityThread.java: 2722) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at android.app.ActivityThread.access$3200(ActivityThread.java:119) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1875) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at android.os.Handler.dispatchMessage(Handler.java:99) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at android.os.Looper.loop(Looper.java:123) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at android.app.ActivityThread.main(ActivityThread.java:4310) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at java.lang.reflect.Method.invokeNative(Native Method) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at java.lang.reflect.Method.invoke(Method.java:521) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:860) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at dalvik.system.NativeStart.main(Native Method) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): Caused by: java.lang.NullPointerException 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java: 100) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at com.satloc.PeriodicUpdationService.<init>(PeriodicUpdationService.java: 31) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at java.lang.Class.newInstanceImpl(Native Method) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at java.lang.Class.newInstance(Class.java:1479) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): at android.app.ActivityThread.handleCreateService(ActivityThread.java: 2719) 07-07 10:58:01.442: ERROR/AndroidRuntime(273): ... 10 more
No idea what it means. All i can understand is that it is unable to get the services object during creation. But i am not sure why. I am calling it using startService(new Intent(context, PeriodicUpdationService.class)); where context is getApplicationContext(); In the Manifest file i have declared as <service android:name=".PeriodicUpdationService" android:enabled="true"/> I am totally confused not sure why it is unable to create the service. Please help. Thanks and Regards, Abhijeeth On Jul 6, 4:56 pm, Mark Murphy <mmur...@commonsware.com> wrote: > On Tue, Jul 6, 2010 at 7:49 AM, Abhi <abishe...@gmail.com> wrote: > > I am trying to create an application which has a service running > > in the background. But i should also be able to re run the service > > when i select option(Here it is a check box) from the fore ground. I > > am getting Unable to instantiate service error. > > This means there is a bug in your service. There should be more > details later in your stack trace, showing you where your service is > crashing. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 2.8 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en