xUtils的使用

RequestParams params=new RequestParams("http://apis.juhe.cn/cook/query.php");
        params.addQueryStringParameter("key","4828e85e3b04e4b0d7ac8afab28a39cf");
        params.addQueryStringParameter("menu","小鸡炖蘑菇");
        params.addQueryStringParameter("pn",index+"");
        params.addQueryStringParameter("rn","10");
        x.http().post(params, new Callback.CommonCallback() {
            @Override
            public void onSuccess(String result) {
                Gson gson = new Gson();
                bean bean = gson.fromJson(result, bean.class);
                List list = bean.getResult().getData();
                if (myadapter==null){
                    myadapter = new myadapter(list);
                    xListView.setAdapter(myadapter);
                }else{
                    myadapter.add(list);
                    myadapter.notifyDataSetChanged();
                }

            }


//加载图片的方法

x.image().bind(holder.img,mylist.get(position).getAlbums().get(0),imageOptions);



你可能感兴趣的:(xUtils的使用)