#Android网络框架Volley
我们先来认识一下Volley:
http://blog.csdn.net/jdsjlzx/article/details/40738181
![](https://img.haomeiwen.com/i291600/2f5f813c4c8534f9.png)
Volley官方源码:
https://android.googlesource.com/platform/frameworks/volley/
![](https://img.haomeiwen.com/i291600/692ff0feb2dec0fa.png)
Google I/O 2013 - Volley: Easy, Fast Networking for Android视频
https://www.youtube.com/watch?v=yhv8l9F44qo&feature=player_embedded
Android Studio如何导入Volley?
Gradle Scripts-->build.gradle,添加如下一行代码:
![](https://img.haomeiwen.com/i291600/eeb0fe4f32679f8e.png)
Volley在线帮助文档——
![](https://img.haomeiwen.com/i291600/0a76ab9fc875b795.png)
代码小困惑——
#Q1 Cannot resolve constructor 'JsonObjectRequest...'
![](https://img.haomeiwen.com/i291600/92473030bf018e50.png)
Solution:
将JsonObjectRequest的参数"null"强转为String类型-_-||
![](https://img.haomeiwen.com/i291600/019f17aa71183b5d.png)
#Q2 AppController.getInstance().addToRequestQueue(req);——NullPointerException
使用AppController时出现空指针异常
![](https://img.haomeiwen.com/i291600/40820ef671632113.png)
![](https://img.haomeiwen.com/i291600/6167e333de39ff37.png)
Solution:
在manifest的application节点里添加如下一句:
android:name="<packagename>.AppController"
![](https://img.haomeiwen.com/i291600/1df048411db33c33.png)
![](https://img.haomeiwen.com/i291600/87f07e5db1a7b83f.png)
=============================================
问题积累中-_-||。。。
网友评论