0
我想知道是否有可能阻止代碼的執行在HTTP請求示例的responseReceived:的Android停止執行
new HttpRequest() {
@Override
public void onResponseReceived(JSONObject result) {
// doing a lot of thing
}
}.get("http://niceUrl");
的onResponseReceived裏面我做了很多的事情(解析JSON,將數據添加到列表,等等。)
當我調用這個函數:
private void stopExecutionOfOnResponseReceived(){
// I would like to stop the previous HttpRequest and launch a new One
}
HttpRequest中是誰繼承抽象類擴展的AsyncTask字符串,沃伊d,JSONObject
asynctask類有方法'cancel()'檢查 –
如果你可以調用cancel方法,你不能阻止它。 – redAllocator