我喜欢在我的回调对象中包含一个变量。 有办法吗?
我的回调是一个界面:
public interface AsyncOpCallback {
public long opStartTime;
public void operationCompleted(Object sender);
}
变量接口给出错误 还有另一种方式吗?
我只需要在返回回调对象后检查opStartTime:
new Thread(new Runnable() {
@Override
public void run() {
//some code
AsyncOpCallback asyncOpCallback =
new AsyncOpCallback() {
public void operationCompleted(Object sender) {
//some code
// check startTime after the call back is received
}
};
asyncOpCallback.opStartTime = new Date().getTime();
expenseClassify.serverPost(asyncOpCallback);
}
}).start();