0

I am trying to end a service started by my fragment.

I tried to end the service in onDestroyView but my service stopped when i switched fragments. I need it to stop when my application closes.

How do I stop service in onDestroy of the activity containing the fragment?

4

1 に答える 1

0
@Override
protected void onDestroy() {
    super.onDestroy();
    stopService(new Intent(this, YourService.class));

}
于 2013-06-19T09:44:06.987 に答える