-
StackOverflow 文档
-
Android 教程
-
Volley
-
取消请求
// assume a Request and RequestQueue have already been initialized somewhere above
public static final String TAG = "SomeTag";
// Set the tag on the request.
request.setTag(TAG);
// Add the request to the RequestQueue.
mRequestQueue.add(request);
// To cancel this specific request
request.cancel();
// ... then, in some future life cycle event, for example in onStop()
// To cancel all requests with the specified tag in RequestQueue
mRequestQueue.cancelAll(TAG);