编译这段代码时出现此错误:
JsonObjectRequest getRequest = new JsonObjectRequest(Request.Method.GET, url,
new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response) {
testtext.setText(response.toString());
}
},
new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error) {
testtext.setText(error.toString());
}
}
);
queue.add(getRequest);
代码应该从url发送get请求,并从中获取JSON。但是我在编译时遇到错误:
Error:(65, 86) error: incompatible types: String cannot be converted to JSONObject
有人能帮助我吗?