を使用してきましたがCallable
、メソッドでパラメーターを使用する関数が必要になりましたcall
。これはの機能ではないことがcall
わかりました。どうすればこれを行うことができますか?
私が現在持っているもの(間違っている):
AsyncTask async = new MyAsyncTask();
async.finished(new Callable(param) {
// the function called during async.onPostExecute;
doSomething(param);
});
async.execute(url);
MyAsyncTask:
...
@Override
protected void onPostExecute(JSONObject result) {
//super.onPostExecute(result);
if(result != null) {
try {
this._finished.call(result); // not valid because call accepts no params
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void finished(Callable<Void> func) {
this._finished = func;
}
...