com.android.volley.toolbox
Class StringRequest
java.lang.Object
com.android.volley.Request<String>
com.android.volley.toolbox.StringRequest
- All Implemented Interfaces:
- Comparable<Request<String>>
public class StringRequest
- extends Request<String>
A canned request for retrieving the response body at a given URL as a String.
Methods inherited from class com.android.volley.Request |
addMarker, cancel, compareTo, deliverError, getBody, getBodyContentType, getCacheEntry, getCacheKey, getHeaders, getMethod, getParams, getParamsEncoding, getPostBody, getPostBodyContentType, getPostParams, getPostParamsEncoding, getPriority, getRetryPolicy, getSequence, getTag, getTimeoutMs, getTrafficStatsTag, getUrl, hasHadResponseDelivered, isCanceled, markDelivered, parseNetworkError, setCacheEntry, setRequestQueue, setRetryPolicy, setSequence, setShouldCache, setTag, shouldCache, toString |
StringRequest
public StringRequest(int method,
String url,
Response.Listener<String> listener,
Response.ErrorListener errorListener)
- Creates a new request with the given method.
- Parameters:
method
- the request Method
to useurl
- URL to fetch the string atlistener
- Listener to receive the String responseerrorListener
- Error listener, or null to ignore errors
StringRequest
public StringRequest(String url,
Response.Listener<String> listener,
Response.ErrorListener errorListener)
- Creates a new GET request.
- Parameters:
url
- URL to fetch the string atlistener
- Listener to receive the String responseerrorListener
- Error listener, or null to ignore errors
deliverResponse
protected void deliverResponse(String response)
- Description copied from class:
Request
- Subclasses must implement this to perform delivery of the parsed
response to their listeners. The given response is guaranteed to
be non-null; responses that fail to parse are not delivered.
- Specified by:
deliverResponse
in class Request<String>
- Parameters:
response
- The parsed response returned by
Request.parseNetworkResponse(NetworkResponse)
parseNetworkResponse
protected Response<String> parseNetworkResponse(NetworkResponse response)
- Description copied from class:
Request
- Subclasses must implement this to parse the raw network response
and return an appropriate response type. This method will be
called from a worker thread. The response will not be delivered
if you return null.
- Specified by:
parseNetworkResponse
in class Request<String>
- Parameters:
response
- Response from the network
- Returns:
- The parsed response, or null in the case of an error