com.android.volley.Request.finish()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中com.android.volley.Request.finish方法的一些代码示例,展示了Request.finish的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.finish方法的具体详情如下:
包路径:com.android.volley.Request
类名称:Request
方法名:finish

Request.finish介绍

[英]Notifies the request queue that this request has finished (successfully or with error).

Also dumps all events from this request's event log; for debugging.
[中]通知请求队列此请求已完成(成功或出现错误)。
还转储此请求的事件日志中的所有事件;用于调试。

代码示例

代码示例来源:origin: mcxiaoke/android-volley

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: chentao0707/SimplifyReader

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: jiangqqlmj/FastDev4Android

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: chentao0707/SimplifyReader

request.finish("network-discard-cancelled");
continue;
request.finish("not-modified");
continue;

代码示例来源:origin: mcxiaoke/android-volley

request.finish("network-discard-cancelled");
continue;
request.finish("not-modified");
continue;

代码示例来源:origin: jiangqqlmj/FastDev4Android

request.finish("network-discard-cancelled");
continue;
request.finish("not-modified");
continue;

代码示例来源:origin: mcxiaoke/android-volley

request.finish("cache-discard-canceled");
continue;

代码示例来源:origin: chentao0707/SimplifyReader

request.finish("cache-discard-canceled");
continue;

代码示例来源:origin: jiangqqlmj/FastDev4Android

request.finish("cache-discard-canceled");
continue;

代码示例来源:origin: MewX/light-novel-library_Wenku8_Android

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: com.mcxiaoke.volley/library

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: AnandChowdhary/saga-android

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: tazimete/android-app-food-delivery-system

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: tazimete/android-app-food-delivery-system

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: jungletian/TitanjumNote

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: panxw/android-volley-manager

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: xuningjack/AndroidNet

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: chuyangliu/tastysnake

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: cat9/EasyVolley

@SuppressWarnings("unchecked")
  @Override
  public void run() {
    // If this request has canceled, finish it and don't deliver.
    if (mRequest.isCanceled()) {
      mRequest.finish("canceled-at-delivery");
      return;
    }
    // Deliver a normal response or error, depending.
    if (mResponse.isSuccess()) {
      mRequest.deliverResponse(mResponse.result);
    } else {
      mRequest.deliverError(mResponse.error);
    }
    // If this is an intermediate response, add a marker, otherwise we're done
    // and the request can be finished.
    if (mResponse.intermediate) {
      mRequest.addMarker("intermediate-response");
    } else {
      mRequest.finish("done");
    }
    // If we have been provided a post-delivery runnable, run it.
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
}

代码示例来源:origin: MewX/light-novel-library_Wenku8_Android

request.finish("network-discard-cancelled");
continue;
request.finish("not-modified");
continue;

相关文章