类 StringRequest

java.lang.Object
com.android.volley.Request<String>
com.android.volley.toolbox.StringRequest
所有已实现的接口:
Comparable<Request<String>>

public class StringRequest extends Request<String>
A canned request for retrieving the response body at a given URL as a String.
  • 构造器详细资料

    • StringRequest

      public StringRequest(int method, String url, Response.Listener<String> listener, Response.ErrorListener errorListener)
      Creates a new request with the given method.
      参数:
      method - the request 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
    • StringRequest

      public StringRequest(String url, Response.Listener<String> listener, Response.ErrorListener errorListener)
      Creates a new GET request.
      参数:
      url - URL to fetch the string at
      listener - Listener to receive the String response
      errorListener - Error listener, or null to ignore errors
  • 方法详细资料

    • deliverResponse

      protected void deliverResponse(String response)
      从类复制的说明: 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.
      指定者:
      deliverResponse 在类中 Request<String>
      参数:
      response - The parsed response returned by Request.parseNetworkResponse(NetworkResponse)
    • parseNetworkResponse

      protected Response<String> parseNetworkResponse(NetworkResponse response)
      从类复制的说明: 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.
      指定者:
      parseNetworkResponse 在类中 Request<String>
      参数:
      response - Response from the network
      返回:
      The parsed response, or null in the case of an error