zoukankan      html  css  js  c++  java
  • 使用Xutils(HttpUtils)请求网络数据


                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) {

                                }

                            }
                        });
           

  • 相关阅读:
    JDBC初体验
    Linux的常用命令--文件的相关操作
    Spring框架之AOP的基本配置
    坦克大战系列7-策略分析之扫描策略和移动策略
    坦克大战系列8-策略分析之瞄准策略
    CF846F Random Query
    CF388C Fox and Card Game
    CF1097F Alex and a TV Show
    CF1276C Beautiful Rectangle
    [SDOI2016]征途
  • 原文地址:https://www.cnblogs.com/weiyangge/p/5352987.html
Copyright © 2011-2022 走看看