java.lang.Object | |
↳ | com.android.volley.toolbox.RequestFuture<T> |
A Future that represents a Volley request. Used by providing as your response and error listeners. For example:
RequestFuture<JSONObject> future = RequestFuture.newFuture(); MyRequest request = new MyRequest(URL, future, future); // If you want to be able to cancel the request: future.setRequest(requestQueue.add(request)); // Otherwise: requestQueue.add(request); try { JSONObject response = future.get(); // do something with response } catch (InterruptedException e) { // handle the error } catch (ExecutionException e) { // handle the error }
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
synchronized boolean | cancel(boolean mayInterruptIfRunning) | ||||||||||
T | get() | ||||||||||
T | get(long timeout, TimeUnit unit) | ||||||||||
boolean | isCancelled() | ||||||||||
synchronized boolean | isDone() | ||||||||||
static <E> RequestFuture<E> | newFuture() | ||||||||||
synchronized void |
onErrorResponse(VolleyError error)
Callback method that an error has been occurred with the
provided error code and optional user-readable message.
| ||||||||||
synchronized void |
onResponse(T response)
Called when a response is received.
| ||||||||||
void | setRequest(Request<?> request) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.android.volley.Response.ErrorListener
| |||||||||||
From interface
com.android.volley.Response.Listener
| |||||||||||
From interface
java.util.concurrent.Future
|
ExecutionException | |
---|---|
InterruptedException |
ExecutionException | |
---|---|
InterruptedException | |
TimeoutException |
Callback method that an error has been occurred with the provided error code and optional user-readable message.
Called when a response is received.