public class

JsonObjectRequest

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

Class Overview

A request for retrieving a JSONObject response body at a given URL, allowing for an optional JSONObject to be passed in as part of the request body.

Summary

[Expand]
Inherited Constants
From class com.android.volley.toolbox.JsonRequest
Public Constructors
JsonObjectRequest(int method, String url, JSONObject jsonRequest, Listener<JSONObject> listener, Response.ErrorListener errorListener)
Creates a new request.
JsonObjectRequest(String url, JSONObject jsonRequest, Listener<JSONObject> listener, Response.ErrorListener errorListener)
Constructor which defaults to GET if jsonRequest is null, POST otherwise.
Protected Methods
Response<JSONObject> 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.toolbox.JsonRequest
From class com.android.volley.Request
From class java.lang.Object
From interface java.lang.Comparable

Public Constructors

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

Creates a new request.

Parameters
method the HTTP method to use
url URL to fetch the JSON from
jsonRequest A JSONObject to post with the request. Null is allowed and indicates no parameters will be posted along with request.
listener Listener to receive the JSON response
errorListener Error listener, or null to ignore errors.

public JsonObjectRequest (String url, JSONObject jsonRequest, Listener<JSONObject> listener, Response.ErrorListener errorListener)

Constructor which defaults to GET if jsonRequest is null, POST otherwise.

Protected Methods

protected Response<JSONObject> 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