1

i am beginner in android development and i develop application with activties and services . now i want to add new option which that disable application. how to stop this services

1
  • now i want to add new option which that disable application pls be more specific
    – Zoombie
    May 16, 2011 at 12:21

3 Answers 3

1

To start the service:

startService(new Intent(ThisActivity.this, YourService.class));

To stop the service:

stopService(new Intent(ThisActivity.this, YourService.class));

They can be called from anywhere within your Activity.

0

You should check the Service Lifecycle.

0

There is no need to stop the service in normal execution. If needed the OS will do that for you.

If you Service has started any background threads then you should stop those of course. But that is done the normal Java way.

You should read Multitasking the Android Way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.