I am unable to get any response from the URL I am hitting using the Volley library, please can you help me out ?
I am getting this on my emulator : "com.android.volley.NoConnectionError:java.io.IOexception:content length promised 45 bytes, but received 0 ."
I have pasted the code below:
RequestQueue queue = Volley.newRequestQueue(this);
String url = "http://ipchicken.com"
JsonObjectRequest jsObjRequest = new JsonObjectRequest(
Request.Method.POST, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
// TODO Auto-generated method stub
sampletext.setText("Response => " + response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// TODO Auto-generated method stub
sampletext.setText( error.toString());
}
});
queue.add(jsObjRequest);