现在开发app,可以说离不开网络操作,今天给大家介绍一下Android网络框架volley的使用方法。
volley简介
Volley主页https://android.googlesource.com/platform/frameworks/volley
Github地址https://github.com/mcxiaoke/android-volley
Volley:2013年Google I/O大会上推出的一个新的Android网络通信框架,能使网络通信更快,更简单,更健壮。
功能:
Json,图像等的异步下载
网络请求的排序(scheduling)
网络请求的优先级处理
缓存
多级别取消请求
和Activity生命周期联动(Activity结束时同时取消所有请求)
使用volley:
compile 'com.mcxiaoke.volley:library:1.0.19'
基本使用方法
StringRequest使用方法:
演示:通过StringRequest发送一个get请求
[html] view plain
copy
print ?
- privatevoidgetStringRequest(){
- Stringurl="http://api.k780.com:88/?app=phone.get&phone=13800138000&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json";
- RequestQueuequeue=Volley.newRequestQueue(this);
- StringRequestrequest=newStringRequest(url,newResponse.Listener<String>(){
- @Override
- publicvoidonResponse(Strings){
- Log.e("success",s);
- }
- },newResponse.ErrorListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorvolleyError){
- }
- });
- queue.add(request);
- }
演示:通过StringRequest发送一个post请求
[html] view plain
copy
print ?
- privatevoidpostStringRequest(){
- Stringurl="http://api.k780.com:88/?app=phone.get";
- RequestQueuequeue=Volley.newRequestQueue(this);
- StringRequestrequest=newStringRequest(Request.Method.POST,url,newResponse.Listener<String>(){
- @Override
- publicvoidonResponse(Strings){
- Log.e("sucess",s);
- }
- },newResponse.ErrorListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorvolleyError){
- }
- }){
- @Override
- protectedMap<String,String>getParams()throwsAuthFailureError{
- Map<String,String>map=newHashMap<>();
- map.put("phone","13800138000");
- map.put("appkey","10003");
- map.put("sign","b59bc3ef6191eb9f747dd4e83c99f2a4");
- map.put("format","json");
- map.put("idcard","110101199001011114");
- returnmap;
- }
- };
- queue.add(request);
- }
通过上述代码,我们可以总结出,StringRequest可以发送get和post请求,但是服务器返回的数据以String类型进行接收。
通过StringRequest发送请求一般需要以下三步:
1.创建一个请求队列RequestQueue
2.创建StringRequest对象
3.将请求对象添加到请求队列中
JsonRequest使用方法:
演示:通过JsonRequest发送一个get请求
[html] view plain
copy
print ?
- privatevoidgetJsonRequest(){
- Stringurl="http://api.k780.com:88/?app=phone.get&phone=13800138000&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json";
- RequestQueuequeue=Volley.newRequestQueue(this);
- JsonObjectRequestrequest=newJsonObjectRequest(url,newResponse.Listener<JSONObject>(){
- @Override
- publicvoidonResponse(JSONObjectjsonObject){
- Log.e("success",jsonObject.toString());
- }
- },newResponse.ErrorListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorvolleyError){
- }
- });
- queue.add(request);
- }
演示:通过JsonRequest发送一个post请求
[html] view plain
copy
print ?
- privatevoidpostJsonRequest(){
- Stringurl="http://api.k780.com:88/?app=phone.get";
- RequestQueuequeue=Volley.newRequestQueue(this);
- JsonObjectRequestrequest=newJsonObjectRequest(Request.Method.POST,url,newResponse.Listener<JSONObject>(){
- @Override
- publicvoidonResponse(JSONObjectjsonObject){
- Log.e("success",jsonObject.toString());
- }
- },newResponse.ErrorListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorvolleyError){
- }
- }){
- @Override
- protectedMap<String,String>getParams()throwsAuthFailureError{
- Map<String,String>map=newHashMap<>();
- map.put("phone","13800138000");
- map.put("appkey","10003");
- map.put("sign","b59bc3ef6191eb9f747dd4e83c99f2a4");
- map.put("format","json");
- map.put("idcard","110101199001011114");
- returnmap;
- }
- };
- queue.add(request);
- }
通过以上分析,可以发现,StringRequest和JsonObjectRequest用法基本一样,只是接收的数据类型不一样。
同理,JsonArrayRequest方法和上面的用法也差不多,这里不做过多介绍。
封装Volley:
具体实现功能如下:
发送get请求
发送post请求
加载网络图片
上传图片
Volley管理的类:
[html] view plain
copy
print ?
- /**
- *管理类
- *@authorYan
- */
- publicclassMyVolley{
- privatestaticfinalStringTAG="MyVolley";
- privatestaticMyVolleyinstance;
- //请求队列
- privatestaticRequestQueuemRequestQueue;
- //创建ImageLoader
- privatestaticImageLoadermImageLoader;
- //默认分配最大空间的几分之几
- privatefinalstaticintRATE=8;
- publicMyVolley(Contextcontext){
- //初始化请求队列(默认创建5个线程)
- mRequestQueue=Volley.newRequestQueue(context);
- //获取ActivityManager管理者
- ActivityManagermanager=(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
- intmaxSize=manager.getMemoryClass()/RATE;
- //初始化ImageLoader对象
- mImageLoader=newImageLoader(mRequestQueue,newBitmapLruCache(1024*1024*maxSize));
- Log.e(TAG,"MyVolley初始化完成");
- }
- /**
- *Volley的初始化操作,使用volley前必须调用此方法
- */
- publicstaticvoidinit(Contextcontext){
- if(instance==null){
- instance=newMyVolley(context);
- }
- }
- /**
- *获取消息队列
- */
- publicstaticRequestQueuegetRequestQueue(){
- throwIfNotInit();
- returnmRequestQueue;
- }
- /**
- *获取ImageLoader
- */
- publicstaticImageLoadergetImageLoader(){
- throwIfNotInit();
- returnmImageLoader;
- }
- /**
- *加入请求队列
- */
- publicstaticvoidaddRequest(Request>request){
- getRequestQueue().add(request);
- }
- /**
- *加载网络图片
- */
- publicstaticvoidgetImage(StringrequestUrl,ImageViewimageView){
- getImage(requestUrl,imageView,0,0);
- }
- /**
- *加载网络图片
- *
- */
- publicstaticvoidgetImage(StringrequestUrl,ImageViewimageView,
- intdefaultImageResId,interrorImageResId){
- getImage(requestUrl,imageView,defaultImageResId,errorImageResId,0,
- 0);
- }
- /**
- *加载网络图片
- *
- */
- publicstaticvoidgetImage(StringrequestUrl,ImageViewimageView,
- intdefaultImageResId,interrorImageResId,intmaxWidth,
- intmaxHeight){
- imageView.setTag(requestUrl);
- try{
- getImageLoader().get(
- requestUrl,
- ImageListenerFactory.getImageListener(imageView,
- defaultImageResId,errorImageResId),maxWidth,
- maxHeight);
- }catch(Exceptione){
- e.printStackTrace();
- }
- }
- /**
- *检查是否完成初始化
- */
- privatestaticvoidthrowIfNotInit(){
- if(instance==null){
- thrownewIllegalStateException("MyVolley尚未初始化,在使用前应该执行init()");
- }
- }
- }
通过以上代码,主要提供了下面几个方法:
1.在构造方法中,初始化一个全局的请求队列RequestQueue,初始化了一个ImageLoader。
2.获取消息队列
3.获取ImageLoader对象
4.将请求加入到消息队列中
5.加载图片
注意:使用MyVolley时,一定要在应用的全局的Application中进行初始化
MyVolley.init(getApplicationContext());
加载图片中涉及到的2个缓存类如下:
[html] view plain
copy
print ?
- /**
- *图片缓存类(Lru算法)
- *@authorYan
- *
- */
- publicclassBitmapLruCacheextendsLruCache<String,Bitmap>implementsImageCache{
- privatestaticfinalStringTAG="BitmapLruCache";
- //图片缓存的软引用
- privateBitmapSoftRefCachesoftRefCache;
- publicBitmapLruCache(intmaxSize){
- super(maxSize);
- //初始化BitmapSoftRefCache
- softRefCache=newBitmapSoftRefCache();
- }
- @Override
- protectedintsizeOf(Stringkey,Bitmapvalue){
- returnvalue.getRowBytes()*value.getHeight();
- }
- @Override
- protectedvoidentryRemoved(booleanevicted,Stringkey,BitmapoldValue,
- BitmapnewValue){
- if(evicted){
- //将bitmap添加到软引用的缓存中
- softRefCache.putBitmap(key,oldValue);
- }
- }
- /**
- *从缓存中获取图片
- */
- @Override
- publicBitmapgetBitmap(Stringurl){
- Bitmapbitmap=get(url);
- if(bitmap==null){
- //从软引用缓存中获取
- bitmap=softRefCache.getBitmap(url);
- }
- returnbitmap;
- }
- /**
- *将图片放入到缓存中
- */
- @Override
- publicvoidputBitmap(Stringurl,Bitmapbitmap){
- put(url,bitmap);
- }
- }
[html] view plain
copy
print ?
- /**
- *图片缓存管理类(软引用)
- *@authorYan
- *
- */
- publicclassBitmapSoftRefCacheimplementsImageCache{
- privatestaticfinalStringTAG="BitmapSoftRefCache";
- //创建一个集合保存Bitmap
- privateLinkedHashMap<String,SoftReference<Bitmap>>map;
- publicBitmapSoftRefCache(){
- map=newLinkedHashMap<>();
- }
- /**
- *根据图片url从缓存中拿出bitmap
- */
- @Override
- publicBitmapgetBitmap(Stringurl){
- Bitmapbitmap=null;
- SoftReference<Bitmap>softRef=map.get(url);
- if(softRef!=null){
- bitmap=softRef.get();
- if(bitmap==null){
- //从集合中移除
- map.remove(url);
- }
- }
- returnnull;
- }
- /**
- *把图片放进缓存中
- */
- @Override
- publicvoidputBitmap(Stringurl,Bitmapbitmap){
- SoftReference<Bitmap>softRef=newSoftReference<Bitmap>(bitmap);
- map.put(url,softRef);
- }
- }
[html] view plain
copy
print ?
- /**
- *图片加载状态监听
- *@authorYan
- *
- */
- publicclassImageListenerFactory{
- privatestaticfinalStringTAG="ImageListenerFactory";
- publicstaticImageListenergetImageListener(finalImageViewview,
- finalintdefaultImageResId,finalinterrorImageResId){
- returnnewImageListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorerror){
- if(errorImageResId!=0){
- view.setImageResource(errorImageResId);
- }
- }
- @Override
- publicvoidonResponse(ImageContainerresponse,booleanisImmediate){
- if(response.getBitmap()!=null){
- if(view.getTag().toString().equals(response.getRequestUrl())){
- view.setImageBitmap(response.getBitmap());
- }
- }
- elseif(defaultImageResId!=0){
- view.setImageResource(defaultImageResId);
- }
- }
- };
- }
- }
这里加载图片采用了LRU算法,然后配合软引用使用,这样会更好的对内存进行管理,代码中注释已经很详细,相信大家都可以理解。
[html] view plain
copy
print ?
- /**
- *返回成功监听(自定义处理逻辑)
- *@authorYan
- */
- publicabstractclassMyReponseListenerimplementsResponse.Listener<BaseVO>{
- @Override
- publicvoidonResponse(BaseVOarg0){
- onMyResponse(arg0);
- }
- publicbooleanonMyResponse(BaseVOt){
- //DialogMaker.closeProgressDialog();
- //自定义处理逻辑
- ...
- returntrue;
- }
- }
[html] view plain
copy
print ?
[html] view plain
copy
print ?
- /**
- *自定义返回错误信息监听
- *
- *@authorYan
- *
- */
- publicabstractclassMyErrorListenerimplementsErrorListener{
- publicvoidonErrorResponse(VolleyErrorerror){
- //自定义同意错误逻辑处理
- ...
- }
- }
下面提供一个请求服务器返回数据后封装成对象的一个GsonRequest:
[html] view plain
copy
print ?
- publicclassGsonRequestextendsRequest<BaseVO>{
- privatestaticfinalStringTAG="GsonRequest";
- //超时时间,默认10秒
- privateintdefaultHttpTimeOut=10*1000;
- //回调监听
- privateListener<BaseVO>listener;
- //返回类型
- privateTypetype;
- //请求参数
- privateMap<String,String>methodBody;
- /**
- *get请求
- *
- *@paramurl
- *@paramtype
- *@paramlistener
- *@paramerrorListener
- */
- publicGsonRequest(Stringurl,Typetype,Listener<BaseVO>listener,
- ErrorListenererrorListener){
- super(Method.GET,url,errorListener);
- //不启用缓存(默认是true)
- setShouldCache(false);
- this.type=type;
- this.listener=listener;
- //设置重连策略
- this.setRetryPolicy(newDefaultRetryPolicy(defaultHttpTimeOut,
- DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
- DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
- }
- /**
- *post请求
- *
- *@parammethodName
- *@parammethodBoby
- *@paramtype
- *@paramlistener
- *@paramerrorListener
- */
- publicGsonRequest(Stringurl,Map<String,String>methodBoby,Typetype,
- Listener<BaseVO>listener,ErrorListenererrorListener){
- super(Method.POST,url,errorListener);
- this.methodBody=methodBoby;
- this.listener=listener;
- this.type=type;
- //不启用缓存
- setShouldCache(false);
- //设置重连策略
- this.setRetryPolicy(newDefaultRetryPolicy(defaultHttpTimeOut,
- DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
- DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
- }
- /**
- *设置请求参数
- */
- @Override
- protectedMap<String,String>getParams()throwsAuthFailureError{
- if(methodBody==null){
- returnsuper.getParams();
- }
- //创建一个集合,保存请求参数
- Map<String,String>map=newLinkedHashMap<>();
- //----此处可以添加多个通用参数
- //map.put(key,value);
- //------
- //------
- //遍历集合
- Iterator<Entry<String,String>>iter=methodBody.entrySet().iterator();
- while(iter.hasNext()){
- Entry<String,String>entry=iter.next();
- map.put(entry.getKey(),entry.getValue());
- }
- returnmap;
- }
- /**
- *将服务器返回的原生字节内容进行转换
- */
- @Override
- protectedResponse<BaseVO>parseNetworkResponse(NetworkResponseresponse){
- try{
- //获取返回的数据(在Content-Type首部中获取编码集,如果没有找到,默认返回ISO-8859-1)
- StringjsonString=newString(response.data,
- HttpHeaderParser.parseCharset(response.headers));
- returnResponse.success(parseNetworkResponseDelegate(jsonString),
- HttpHeaderParser.parseCacheHeaders(response));
- }catch(Exceptione){
- returnResponse.error(newParseError(e));
- }
- }
- /**
- *将服务器返回的内容用gson进行封装
- */
- privateBaseVOparseNetworkResponseDelegate(StringjsonString){
- returnnewGson().fromJson(jsonString,type);
- }
- /**
- *将解析后的数据进行回调
- */
- @Override
- protectedvoiddeliverResponse(BaseVOarg0){
- listener.onResponse(arg0);
- }
- }
下面提供一个请求服务器返回XML格式数据后的一个XMLRequest:
[html] view plain
copy
print ?
- **
- *服务器以XML格式返回数据
- *@authorYan
- */
- publicclassXMLRequestextendsRequest<XmlPullParser>{
- privateListener<XmlPullParser>mListener;
- publicXMLRequest(intmethod,Stringurl,Listener<XmlPullParser>listener,
- ErrorListenererrorListener){
- super(method,url,errorListener);
- //不启用缓存
- setShouldCache(false);
- mListener=listener;
- }
- publicXMLRequest(Stringurl,Listener<XmlPullParser>listener,ErrorListenererrorListener){
- this(Method.GET,url,listener,errorListener);
- }
- /**
- *解析服务器返回的数据
- */
- @Override
- protectedResponse<XmlPullParser>parseNetworkResponse(
- NetworkResponseresponse){
- try{
- StringxmlString=newString(response.data,
- HttpHeaderParser.parseCharset(response.headers));
- //创建解析工厂
- XmlPullParserFactoryfactory=XmlPullParserFactory.newInstance();
- //获取解析器
- XmlPullParserxmlPullParser=factory.newPullParser();
- //设置解析数据
- xmlPullParser.setInput(newStringReader(xmlString));
- returnResponse.success(xmlPullParser,HttpHeaderParser.parseCacheHeaders(response));
- }catch(UnsupportedEncodingExceptione){
- returnResponse.error(newParseError(e));
- }catch(XmlPullParserExceptione){
- returnResponse.error(newParseError(e));
- }
- }
- /**
- *分发结果
- */
- @Override
- protectedvoiddeliverResponse(XmlPullParserresponse){
- mListener.onResponse(response);
- }
- }
下面提供一个文件上传(支持多文件)的一个PostUploadRequest:
上传文件的FormImage类如下:
[html] view plain
copy
print ?
- publicclassFormImage{
- //参数的名称
- privateStringname;
- //文件名
- privateStringfileName;
- //文件的mine
- privateStringmime;
- //需要上传的文件
- privateFilefile;
- publicFormImage(){
- }
- publicFilegetFile(){
- returnfile;
- }
- publicvoidsetFile(Filefile){
- this.file=file;
- }
- publicStringgetMime(){
- returnmime;
- }
- publicvoidsetMime(Stringmime){
- this.mime=mime;
- }
- publicStringgetFileName(){
- returnfileName;
- }
- publicvoidsetFileName(StringfileName){
- this.fileName=fileName;
- }
- publicStringgetName(){
- returnname;
- }
- publicvoidsetName(Stringname){
- this.name=name;
- }
- //对文件进行二进制转换
- publicbyte[]getValue(){
- byte[]buffer=null;
- try{
- FileInputStreamfis=newFileInputStream(file);
- ByteArrayOutputStreambos=newByteArrayOutputStream(1024);
- byte[]b=newbyte[1024];
- intn;
- while((n=fis.read(b))!=-1){
- bos.write(b,0,n);
- }
- fis.close();
- bos.close();
- buffer=bos.toByteArray();
- }catch(FileNotFoundExceptione){
- e.printStackTrace();
- }catch(IOExceptione){
- e.printStackTrace();
- }
- returnbuffer;
- }
下面演示如何使用封装后的方法进行网络请求:
1.发送get请求:
[html] view plain
copy
print ?
- privatevoidgetMyVolley(){
- Stringurl="http://api.k780.com:88/?app=idcard.get&idcard=110101199001011114&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json";
- GsonRequestrequest=newGsonRequest(url,PersonInfoBean.class,newMyReponseListener(){
- @Override
- publicvoidonResponse(BaseVOt){
- super.onResponse(t);
- PersonInfoBeanbean=(PersonInfoBean)t;
- Log.e("success",bean.toString());
- }
- },newMyErrorListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorerror){
- super.onErrorResponse(error);
- }
- });
- MyVolley.addRequest(request);
- }
2.发送post请求:
[html] view plain
copy
print ?
- privatevoidpostMyVolley(){
- Stringurl="http://api.k780.com:88/?app=idcard.get";
- Map<String,String>map=newHashMap<>();
- map.put("appkey","10003");
- map.put("sign","b59bc3ef6191eb9f747dd4e83c99f2a4");
- map.put("format","json");
- map.put("idcard","110101199001011114");
- GsonRequestrequest=newGsonRequest(url,map,PersonInfoBean.class,newMyReponseListener(){
- @Override
- publicvoidonResponse(BaseVOvo){
- super.onResponse(vo);
- PersonInfoBeanbean=(PersonInfoBean)vo;
- Log.e("sucess",bean.toString());
- }
- },newMyErrorListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorerror){
- super.onErrorResponse(error);
- }
- });
- MyVolley.addRequest(request);
- }
3.上传多文件演示:
[html] view plain
copy
print ?
- //上传文件路径
- Stringurl="http://192.168.1.107:8080/FileUpload/FileServlet";
- List<FormImage>list=newArrayList<>();
- Stringpath1=Environment.getExternalStorageDirectory().getPath()+File.separator+"ss.png";
- Stringpath2=Environment.getExternalStorageDirectory().getPath()+File.separator+"ic_launcher.png";
- Filefile1=newFile(path1);
- Filefile2=newFile(path2);
- FormImagef1=newFormImage();
- f1.setFile(file1);
- f1.setFileName("t1");
- f1.setName("file1");
- f1.setMime("image/png");
- list.add(f1);
- FormImagef2=newFormImage();
- f2.setFile(file2);
- f2.setFileName("t2");
- f2.setName("file2");
- f2.setMime("image/png");
- list.add(f2);
- PostUploadRequestrequest=newPostUploadRequest(url,list,newResponse.Listener<String>(){
- @Override
- publicvoidonResponse(Strings){
- Log.e("success",s);
- }
- },newResponse.ErrorListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorvolleyError){
- }
- });
- MyVolley.addRequest(request);
- }
4.发送请求,服务器返回XML:
[html] view plain
copy
print ?
- privatevoidgetXml(){
- Stringurl="http://flash.weather.com.cn/wmaps/xml/china.xml";
- XMLRequestrequest=newXMLRequest(url,newResponse.Listener<XmlPullParser>(){
- @Override
- publicvoidonResponse(XmlPullParserxmlPullParser){
- try{
- inteventType=xmlPullParser.getEventType();
- while(eventType!=XmlPullParser.END_DOCUMENT){
- switch(eventType){
- caseXmlPullParser.START_TAG:
- StringnodeName=xmlPullParser.getName();
- if("city".equals(nodeName)){
- StringpName=xmlPullParser.getAttributeValue(0);
- Log.e("TAG","cityis"+pName);
- }
- break;
- }
- eventType=xmlPullParser.next();
- }
- }catch(Exceptione){
- e.printStackTrace();
- }
- }
- },newResponse.ErrorListener(){
- @Override
- publicvoidonErrorResponse(VolleyErrorvolleyError){
- }
- });
- MyVolley.addRequest(request);
- }
4.利用ImageLoader加载图片:
[html] view plain
copy
print ?
- publicclassMyAdapterextendsBaseAdapter{
- privateContextcontext;
- privateList<Person>list;
- privateLayoutInflatermInflater;
- publicViewHolderholder;
- publicMyAdapter(Contextcontext,List<Person>list){
- this.context=context;
- this.list=list;
- this.mInflater=LayoutInflater.from(context);
- }
- @Override
- publicintgetCount(){
- returnlist.size();
- }
- @Override
- publicObjectgetItem(intposition){
- returnlist.get(position);
- }
- @Override
- publiclonggetItemId(intposition){
- returnposition;
- }
- @Override
- publicViewgetView(intposition,ViewconvertView,ViewGroupparent){
- holder=null;
- if(convertView==null){
- convertView=mInflater.inflate(R.layout.itemone,null);
- holder=newViewHolder();
- holder.iv_image=(ImageView)convertView.findViewById(R.id.iv_image);
- holder.tv_name=(TextView)convertView.findViewById(R.id.tv_name);
- convertView.setTag(holder);
- }
- else{
- holder=(ViewHolder)convertView.getTag();
- }
- Personbean=list.get(position);
- holder.tv_name.setText(bean.getName());
- MyVolley.getImage(bean.getImgUrl(),holder.iv_image,R.mipmap.ic_launcher,R.mipmap.ic_launcher,150,150);
- returnconvertView;
- }
- classViewHolder{
- privateTextViewtv_name;
- privateImageViewiv_image;
- }
- }
上面主要介绍了如何封装Volley,并且如何使用封装后的MyVolley进行网络请求。
演示:
今天说了这么多,相信大家一定对Volley可以达到基本掌握的情况了,本篇文章主要是从实战角度出发,主要是让大家体验一下volley的框架封装的用法,volley的源码本篇文章没有涉及到,但是这完全不影响大家使用volley,后续有时间我会从源码角度进行分析volley,说了这么多,有点饿了,今天就说到这里了,大家快快练习一下Volley的操作吧~!
源码链接:http://download.csdn.net/detail/a1002450926/9379197