使用JsonObjectRequest时出现编译错误 [英] Compililation Error while using JsonObjectRequest
本文介绍了使用JsonObjectRequest时出现编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用mcxiaoke/android-volley库.编译错误为
I'm using mcxiaoke/android-volley library.Im getting compilation error as
Error:(77, 37) error: reference to JsonObjectRequest is ambiguous, both constructor
JsonObjectRequest(int,String,String,Listener<JSONObject>,ErrorListener) in JsonObjectRequest and constructor
JsonObjectRequest(int,String,JSONObject,Listener<JSONObject>,ErrorListener) in JsonObjectRequest match
这是我的代码.我不知道怎么了.任何帮助表示赞赏
this is my code.I dont know what is wrong. Any help appreciated
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET,
getRequestUrl(10),
null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
推荐答案
将null转换为字符串或JSONObject,我认为它应该可以正常工作.
Cast the null to string or JSONObject and it should work fine i think.
new JsonObjectRequest(Request.Method.GET,
getRequestUrl(10),
(String)null,
new Response.Listener<JSONObject>()
这篇关于使用JsonObjectRequest时出现编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文