|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.volley.toolbox.RequestFuture<T>
T
- The type of parsed response this future expects.public class 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 }
Method Summary | ||
---|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
|
|
T |
get()
|
|
T |
get(long timeout,
TimeUnit unit)
|
|
boolean |
isCancelled()
|
|
boolean |
isDone()
|
|
static
|
newFuture()
|
|
void |
onErrorResponse(VolleyError error)
Callback method that an error has been occurred with the provided error code and optional user-readable message. |
|
void |
onResponse(T response)
Called when a response is received. |
|
void |
setRequest(Request<?> request)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <E> RequestFuture<E> newFuture()
public void setRequest(Request<?> request)
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface Future<T>
public T get() throws InterruptedException, ExecutionException
get
in interface Future<T>
InterruptedException
ExecutionException
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<T>
InterruptedException
ExecutionException
TimeoutException
public boolean isCancelled()
isCancelled
in interface Future<T>
public boolean isDone()
isDone
in interface Future<T>
public void onResponse(T response)
Response.Listener
onResponse
in interface Response.Listener<T>
public void onErrorResponse(VolleyError error)
Response.ErrorListener
onErrorResponse
in interface Response.ErrorListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |