【发布时间】:2017-10-19 06:19:09
【问题描述】:
我在活动中有一种方法,其中一些操作是从非活动类执行的。我想知道非活动类网络操作何时完成,以便我可以再次调用该方法。但是当我调用非活动类时,该方法最后会转到。这是我的代码,..
public void somemethod(){
.
.
.
.
if (condition) {
new RegenerateToken().generate(DriverActivity.this); // calling non activity class which perform some network operation
//here i want to know that non activity class has performed the network operation so i can call this method again
}
.
.
.
log.d("method","ending");
}
非活动类
public class RegenerateToken {
public void generate(Context context) {
ExecuteServerReq executeServerReq = new ExecuteServerReq(context, client, Utilz.URL + "/authenticate", params, true, true);
executeServerReq.execute();
executeServerReq.getResponse = new ExecuteServerReq.GetResponse() {
@Override
public void onResponse(String objects) {
Utilz.printLog("RegenerateTokenresponse", objects);
}
};
}
}
【问题讨论】:
标签: java android methods controls flow