HI

@Override protected void onDestroy() {
  super.onDestroy();

  _shutdownService();

  if (MAIN_ACTIVITY != null) AppUtils.showToastShort(MAIN_ACTIVITY,
"MyService stopped");

}

U can check here .....for starting and stopping the service tutorial
is there with good example

http://developerlife.com/tutorials/?p=356



On Thu, Aug 6, 2009 at 6:00 PM, Archana <[email protected]> wrote:

>
> Hi ,
>
>  How can we stop Service.I tried put it in both  onstop and ondestroy()
> method.While exiting It is calling this method but service still
> running background.Whether i am doing anything wrong?
>
> private static Intent serviceIntent ;
>
> protected void onCreate() {
> serviceIntent = new Intent(this, LocalService.class);
>                startService(serviceIntent);
> }
> @Override
>        protected void onStop() {
>                // TODO Auto-generated method stub
>                super.onStop();
>                Log.e("CallingOnStop", "OnStop");
>                stopService(serviceIntent);
>        }
>
>        @Override
>        protected void onDestroy() {
>                // TODO Auto-generated method stub
>                super.onDestroy();
>                Log.e("CallingOnDEstroy", "OnDestroy");
>                stopService(serviceIntent);
>        }
> >
>


-- 
Regards
-------------------
Desu Vinod Kumar
[email protected]
09176147148

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to