首页 > Web开发 > 详细

使用Xutils(HttpUtils)请求网络数据

时间:2016-04-04 22:24:24      阅读:421      评论:0      收藏:0      [点我收藏+]


            HttpUtils utils = new HttpUtils();
            utils.send(HttpMethod.POST, urls[i] + 1,
                    new RequestCallBack<String>() {

                        @Override
                        public void onFailure(HttpException arg0, String arg1) {
                            // TODO Auto-generated method stub

                        }

                        @Override
                        public void onSuccess(ResponseInfo<String> arg0) {

//解析数据
                            String result = arg0.result;
                             if (i == 0 || i == 1) {

                                XStream stream = new XStream();
                                stream.processAnnotations(Super1.class);

                                Super1 super1 = (Super1) stream.fromXML(result);
                                List<News> list = super1.getNewslist()
                                        .getNews();
                                System.out.println("集合:" + list);

                            }
                            if (i == 2 || i == 3) {

                            }

                        }
                    });
       

使用Xutils(HttpUtils)请求网络数据

原文:http://www.cnblogs.com/weiyangge/p/5352987.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!