interface - implementing listener for background activity android -


i using data droid library speed asynchronous tasks. in data droid there method similar onpostexecute of async task.i performing async task using data droid pre fetching of data. want implement listener notifying background process completion activity.can explain how achieve interface.i have gone through many stackoverflow questions still unclear how implement interface this.

public abstract class baseactivity extends activity implements completionlistener { completionlistener completionlistener; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     completionlistener=this; }   class mytask extends asynctask<void, void, void>{      @override     protected void doinbackground(void... params) {         // todo auto-generated method stub         return null;     }     @override     protected void onpostexecute(void result) {         super.onpostexecute(result);         completionlistener.oncompletion();     } }  } 

let activity extend baseactivity , mytask asynchronous task activity extending base class receive call onpostexecute();

public interface completionlistener { public void oncompletion(); } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -