com.bumptech.glide.integration.volley
Class VolleyRequestFuture<T>
java.lang.Object
com.bumptech.glide.integration.volley.VolleyRequestFuture<T>
- Type Parameters:
T
- The type of parsed response this future expects.
- All Implemented Interfaces:
- com.android.volley.Response.ErrorListener, com.android.volley.Response.Listener<T>, Future<T>
public class VolleyRequestFuture<T>
- extends Object
- implements Future<T>, com.android.volley.Response.Listener<T>, com.android.volley.Response.ErrorListener
TODO: contribute cancel modifications to volley and remove this class.
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
}
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VolleyRequestFuture
public VolleyRequestFuture()
newFuture
public static <E> VolleyRequestFuture<E> newFuture()
setRequest
public void setRequest(com.android.volley.Request<?> request)
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interface Future<T>
get
public T get()
throws InterruptedException,
ExecutionException
- Specified by:
get
in interface Future<T>
- Throws:
InterruptedException
ExecutionException
get
public T get(long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
- Specified by:
get
in interface Future<T>
- Throws:
InterruptedException
ExecutionException
TimeoutException
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface Future<T>
isDone
public boolean isDone()
- Specified by:
isDone
in interface Future<T>
onResponse
public void onResponse(T response)
- Specified by:
onResponse
in interface com.android.volley.Response.Listener<T>
onErrorResponse
public void onErrorResponse(com.android.volley.VolleyError error)
- Specified by:
onErrorResponse
in interface com.android.volley.Response.ErrorListener