public class

StringRequest

extends Request<T>
java.lang.Object
   ↳ com.android.volley.Request<T>
     ↳ com.android.volley.toolbox.StringRequest

Class Overview

A canned request for retrieving the response body at a given URL as a String.

Summary

Public Constructors
StringRequest(int method, String url, Listener<String> listener, Response.ErrorListener errorListener)
Creates a new request with the given method.
StringRequest(String url, Listener<String> listener, Response.ErrorListener errorListener)
Creates a new GET request.
Protected Methods
void deliverResponse(String response)
Subclasses must implement this to perform delivery of the parsed response to their listeners.
Response<String> parseNetworkResponse(NetworkResponse response)
Subclasses must implement this to parse the raw network response and return an appropriate response type.
[Expand]
Inherited Methods
From class com.android.volley.Request
From class java.lang.Object
From interface java.lang.Comparable

Public Constructors

public StringRequest (int method, String url, Listener<String> listener, Response.ErrorListener errorListener)

Creates a new request with the given method.

Parameters
method the request Method to use
url URL to fetch the string at
listener Listener to receive the String response
errorListener Error listener, or null to ignore errors

public StringRequest (String url, Listener<String> listener, Response.ErrorListener errorListener)

Creates a new GET request.

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

Protected Methods

protected void deliverResponse (String response)

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.

Parameters
response The parsed response returned by parseNetworkResponse(NetworkResponse)

protected Response<String> parseNetworkResponse (NetworkResponse response)

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.

Parameters
response Response from the network
Returns
  • The parsed response, or null in the case of an error