Deploy a callback from a service into action

I played with Service, but I can’t get them to work as I need. I need to call functions Servicefrom Activity, and I use this

public class LocalBinder extends Binder {
    LocalService getService() {
        return LocalService.this;
    }
}

But how do I cancel an action after a long network operation?

I want to show the spinner in the action bar while the service is doing something, and when it finishes, to hide it. I also need it to persist in all different actions that have the same action bar.

It is also ServiceConnectionan asynchronous callback, so how do I bind to a service, wait for a callback, and then change from case to case, which function of the service to call?

+5
source share
1

, , (, asyncTask), , , , .

0

All Articles