java - Get self instance inside interface implementation -


i'm new java/android.

i have service class have 2 methods.... prepare() , execute()..

both async calls, have is, call prepare() , wait preparefinished i'm listen to.... when prepare method finished, same service instance i'd call execute() method.....

follow try below:

for(int idx = 0; idx < services.length; idx++) {     myservice instance = services[idx];     instance.setdatareadlistener(new asyncdatareadlistener() {         @override         public void preparefinished(serviceinfo info) {             //i self instannce here call                         //method after been prepared. like::: sender.execute()          }     }); }  //in button click call above,  each service prepared method of same service instance called: for(int idx = 0; idx < services.length; idx++) {     myservice instance = services[idx];     //async call     instance.prepare(); } 

how can accomplish it?

tks.

make instance final:

final myservice instance = services[idx]; 

and can call instance.execute() inside preparefinished.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -