我无法从我使用 Volley 库点击的 URL 获得任何响应,请您帮帮我吗?
我在我的模拟器上得到了这个:“com.android.volley.NoConnectionError:java.io.IOexception:content length promise 45 bytes, but received 0.”
我已经粘贴了下面的代码:
字符串 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);