Reputation: 4576
I'm using Volley to make a GET request to an API:
StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.i("RESPONSE",response);
//this method parses the JSON response and fills it into a custom ArrayList
parseResponse(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.i("Sorry", "unable to get the response!");
}
});
The expected JSON object response is big (could be upto 500 KB). I'm unable to see the complete response in my logs. Only the first 50 lines or so are displayed. I'm also getting BasicNetwork.logSlowRequests
info:
BasicNetwork.logSlowRequests: HTTP response for request=<[ ]
which means the request is taking more than 3000 ms.
Things tried:
I've increased the logger buffer sizes to 1M in Developers Options in the phone.
What could be the reason? Is the response sent in chunks when it's big? If so, how to join them to parse the full response?
Upvotes: 2
Views: 1895
Reputation: 12379
Log does not show the complete string if it very big ,try writing to a file on disk and check it should be complete.
Also you can use this method to print complete log:
public static void longInfo(String str) {
if(str.length() > 4000) {
Log.i(TAG, str.substring(0, 4000));
longInfo(str.substring(4000));
} else
Log.i(TAG, str);
}
Upvotes: 2