Android 如何在改装2中按标签取消请求?

Android 如何在改装2中按标签取消请求?,android,android-volley,retrofit2,okhttp,okhttp3,Android,Android Volley,Retrofit2,Okhttp,Okhttp3,有没有办法像截击一样,通过标签取消改装2中的特定请求。 在截击中,我们可以这样做来取消请求 sRequestQueue = Volley.newRequestQueue(appContext); public void enqueueRequest(Request req) { sRequestQueue.add(req); } public void cancelTaggedRequests(String tag) { sRequestQueue.cancelAll(t

有没有办法像截击一样,通过标签取消改装2中的特定请求。 在截击中,我们可以这样做来取消请求

sRequestQueue = Volley.newRequestQueue(appContext);


public void enqueueRequest(Request req) {
    sRequestQueue.add(req);
}


public void cancelTaggedRequests(String tag) {
    sRequestQueue.cancelAll(tag);
}

改装2.0中是否有类似的方法?

您可以通过调用
call.cancel()取消请求

另一种方法是使用RxJava创建订阅和取消订阅请求

if (subscription != null && !subscription.isUnsubscribed()) {
  subscription.unsubscribe();
}

对于RxJava,我们如何取消它?