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

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

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

Request.deliverResponse介绍

[英]Subclasses must implement this to perform delivery of the parsed response to their listeners. The given response is guaranteed to be non-null; responses that fail to parse are not delivered.
[中]子类必须实现这一点,才能将解析后的响应传递给它们的侦听器。给定的响应保证为非空;无法解析的响应不会被传递。

代码示例

代码示例来源: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: 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: 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: 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: 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: 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: 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: 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: CaMnter/AndroidLife

mRequest.deliverResponse(mResponse.result);
} else {

相关文章