When I am making a network call using jsonObject request. I am not receiving any response. I always receive HTTP response for request=<[ ] before my URL. I have tried these l
Another Solution using StringRequest
to get Json Response
private void callApi() {
RequestQueue mrequestQueue;
StringRequest stringRequest;
mrequestQueue = Volley.newRequestQueue(this);
stringRequest = new StringRequest(Request.Method.GET, DATA_URL, new Response.Listener() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response);
System.out.println("json"+jsonObject);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//Log.i(TAG, "Response: " + error.toString());
}
});
mrequestQueue.add(stringRequest);
}