FileDocCategorySizeDatePackage
StringRequest.javaAPI DocAndroid 5.1 API2548Thu Mar 12 22:22:56 GMT 2015com.android.volley.toolbox

StringRequest

public class StringRequest extends com.android.volley.Request
A canned request for retrieving the response body at a given URL as a String.

Fields Summary
private final com.android.volley.Response.Listener
mListener
Constructors Summary
public StringRequest(int method, String url, com.android.volley.Response.Listener listener, com.android.volley.Response.ErrorListener errorListener)
Creates a new request with the given method.

param
method the request {@link Method} to use
param
url URL to fetch the string at
param
listener Listener to receive the String response
param
errorListener Error listener, or null to ignore errors

        super(method, url, errorListener);
        mListener = listener;
    
public StringRequest(String url, com.android.volley.Response.Listener listener, com.android.volley.Response.ErrorListener errorListener)
Creates a new GET request.

param
url URL to fetch the string at
param
listener Listener to receive the String response
param
errorListener Error listener, or null to ignore errors

        this(Method.GET, url, listener, errorListener);
    
Methods Summary
protected voiddeliverResponse(java.lang.String response)

        mListener.onResponse(response);
    
protected com.android.volley.ResponseparseNetworkResponse(com.android.volley.NetworkResponse response)

        String parsed;
        try {
            parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
        } catch (UnsupportedEncodingException e) {
            parsed = new String(response.data);
        }
        return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));