volley使用中问题汇总


标题

volley.ParseError

com.android.volley.ParseError:
org.json.JSONException:Value indexModule of type java.lang.String connot be converted to JSONObject

服务器返回值不是json格式,而使用了JsonRequest。解决办法,检查后台返回json的合法性;不使用JsonRequest。

If you want to receive the result as a string don’t use the JSONRequest. Go with the simple Request class. Your problem is pretty simple the server is giving back a JSONArray with just one element inside. A JSONArray is not a JSONObject. That’s why the parsing is failing.

如果你想获得的结果作为一个字符串不使用jsonrequest。使用简单请求类。你的问题是很简单的服务器给后面的一个jsonarray只有一个元素里面。一个jsonarray不是JSONObject。这就是解析失败的原因。

volley.NoConnectionError

com.android.volley.NoConnectionError:
java.net.ConnectException:failed to connect to /192.168.0.105(port 80) after 5000ms:isConnected failed:EHOSTUNREACH(No route to host)

无法连接到/ 192.168.0.105(端口80)后5000ms:连接失败:EHOSTUNREACH(没有路由到主机)

服务器相应超时。请检查接口。

标题

智能推荐

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告