【发布时间】:2015-04-06 09:39:00
【问题描述】:
我正在调用 android 中的 Web 服务。因为我想调用 URL 我没有向服务器发送任何参数,只是调用 URL,
但它会出现类似 [10520] BasicNetwork.performRequest: Unexpected response code 401 的错误
我的代码是
RequestQueue queue = Volley.newRequestQueue(getActivity());
JsonObjectRequest getRequest = new JsonObjectRequest(Request.Method.GET, Server.URL, null,
new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response) {
// display response
hideProgressDialog();
}
},
new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error) {
hideProgressDialog();
}
}
);
// add it to the RequestQueue
queue.add(getRequest);
如何解决?
【问题讨论】:
标签: android http-headers android-volley