标签:android blog http java color get
Android网络通讯架构——Volley
1、 Volley提供的功能
简单来说,它提供了如下的便利功能:
2、学习前的准备:下载volley源码打成jar包(我通过这个网址下载不下了,但是网络上很多好心人已经分享了源码)
下载地址:
mirror of volley library from android source
from :
https://android.googlesource.com/platform/frameworks/volley
original:
git clone
https://android.googlesource.com/platform/frameworks/volley
update weekly from android source repo
3、正式开工:
简单例子:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 |
private
void getStringVolley() { RequestQueue requestQueue = Volley.newRequestQueue( this ); StringRequest sRequest= new
StringRequest(Request.Method.GET,CITY_CODE_URL, new
Listener<String>() { @Override public
void onResponse(String response) { System.out.println(response); } }, new
Response.ErrorListener() { @Override public
void onErrorResponse(VolleyError arg0) { System.out.println( "sorry,Error" ); } }); sRequest.setShouldCache( false ); requestQueue.add(sRequest); } |
标签:android blog http java color get
原文地址:http://www.cnblogs.com/yuanyuan-5683/p/3769876.html