私はJava/Androidが初めてです。
私は2つのメソッドを持つサービスクラスを持っています....準備()と実行()..
どちらも非同期呼び出しなので、私がしなければならないことは、prepare() を呼び出して、私がリッスンしている prepareFinished を待つことです.... prepare メソッドが終了したら、execute( を呼び出したい同じサービス インスタンスに対して) ) 方法.....
以下の私の試みに従ってください:
for(int idx = 0; idx < services.length; idx++)
{
MyService instance = services[idx];
instance.setDataReadListener(new AsyncDataReadListener() {
@Override
public void prepareFinished(ServiceInfo info) {
//I would like to get the self instannce here to call another
//method after been prepared. something like::: sender.execute()
}
});
}
//In a button click I call above, for each service its prepared I would like another method of the same service instance to be called:
for(int idx = 0; idx < services.length; idx++)
{
MyService instance = services[idx];
//async call
instance.prepare();
}
どうすればそれを達成できますか?
わかりました。