-
Volley特点查看全部
-
Volley与Activity的生命周期联动 在Activity的onStop();中执行queuecancelAll(tag);明确取消哪个请求查看全部
-
request.settag("abc");作为请求的标识符 queue.add(request);为发送请求查看全部
-
StringRequest request = new Stringrequest(,,,,,); JsonObjectRequest request = new JsonObjectRequest(,,,,,);查看全部
-
Volley特点: 通信更快,更简单 Get,Post网络请求以及网络图片的高效率异步处理请求 排序 网络请求 多级别取 和Activity生命周期的联动查看全部
-
Volley请求网络挑选合适的对象(也就是请求网络的返回值) StringRequest jsonObjectRequest jsonObjectRequest查看全部
-
。。。不支持上传、下载查看全部
-
q查看全部
-
volley_post查看全部
-
volley特点查看全部
-
Volley请求图片: ImageRequest request=new ImageRequest(url,成功,宽0,高0,Config.RGB_565,失败) 成功:onResponse(Bitmap arg0)查看全部
-
建立请求队列查看全部
-
Volley简单二次封装: 定义请求类: VolleyRequest 定义成员方法: static void RequestGet(Context mcontext,String url,String tag,VollaeyMethodManage vmm ) static void RequestPost(Context mcontext,String url,String tag,Map<String,String>,VollaeyMethodManage vmm) 创建成员对象: static StringRequest request;请求对象 static Context context;上下文对象 RequestGet(xxx){ MyApplication.getHttpQueues().cancleAll(tag);//取消请求 避免重复 request=new StringRequest(Method.GET,url,vmm.loadListener,vm.errLs) request.setTag(tag) MyApplication.getHttpQueues().add(requeset); } --------------------------------------------- 创建[抽象]类,管理两个方法: [abstract] class VolleyMethodManage; 创建成员: Context mcontext; Listener<String>mlistener,成功响应 ErrorListener merrorlistener失败响应 定义成员方法: 提供外部方法接入: public abstract void onMySuccess(String result) public abstract void onMyError(VollyError error) 封装成功调用: Listener<String> loadListener() { mlistener=new Listener<String> { @override void onResponse(String arg0) { onMySuccess(arg0) } }; return mListener; }查看全部
-
Volley 与Activity关联: 在Activity的onStop方法中, MyApplication.getHttpQueues().cancleAll("abcGet"设置的Tag)查看全部
-
Volley Post请求: url 写到?为止 StringRequest request=new StringRequest(Method.POST,url,成功响应,失败响应){ 实现getParams()方法 getParams{ Map<string,string>hashMap=new HashMap<String,String>(); hashMap.put("phone",12346); hashMap.put("key","akjhdfhjg") return hashMap; } } 或者使用JsonObject JsonObject object=new JsonObject(hashMap); JsonObjectRequest request=new JsonObjectRequest(Method.POST,object,成功,失败) request.setTag("abcPost") MyApplication.getHttpQueues().add(request);查看全部
举报
0/150
提交
取消