android - How to call jobFinished from IntentService -


i trigger inside jobservice intentservice encapsulate simple tasks. how should call jobfinished( param, false ) after intentservice has finished , tell jobservice done? should bind jobservice , call directly or exist better solution?

in many cases, have interface , pass along object implements it. dialogs example have onclicklistener.

just random example:

// callback interface  interface mycallback {      void callbackcall();  }    // class takes callback  class worker {     mycallback callback;       void onevent() {        callback.callbackcall();     }  }    // option 1:    class callback implements mycallback {     void callbackcall() {        // callback code goes here     }  }    worker.callback = new callback();    // option 2:    worker.callback = new mycallback() {       void callbackcall() {        // callback code goes here     }  };

just image better understandingenter image description here


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -