Well, I see the situation, and this happens because, as your mistake says, the constructor does not exist.
If you use JsonObjectRequest by default and want to use the Get method, you do not need to send a null parameter, you just have to send it as follows:
Change this:
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET,"http://10.0.8.152/json/new.json",null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { System.out.println(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); requestQueue.add(request);
For this:
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET,"http://10.0.8.152/json/new.json", new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { System.out.println(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); requestQueue.add(request);
As you can see, I just delete the parameter for JsonObject, because the Get method is the constructor that agrees that you are not sending JsonObject.
Another solution is to create your own JsonObjectRequest and configure it to accept such values.
Sincerely.
Max pinto
source share