public class

RequestFuture

extends Object
implements Response.ErrorListener Response.Listener<T> Future<V>
java.lang.Object
   ↳ com.android.volley.toolbox.RequestFuture<T>

Class Overview

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
 }
 

Summary

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

Public Methods

public synchronized boolean cancel (boolean mayInterruptIfRunning)

public T get ()

Throws
ExecutionException
InterruptedException

public T get (long timeout, TimeUnit unit)

Throws
ExecutionException
InterruptedException
TimeoutException

public boolean isCancelled ()

public synchronized boolean isDone ()

public static RequestFuture<E> newFuture ()

public synchronized void onErrorResponse (VolleyError error)

Callback method that an error has been occurred with the provided error code and optional user-readable message.

public synchronized void onResponse (T response)

Called when a response is received.

public void setRequest (Request<?> request)