A联合之bundle传值在xlistview中获取
来源:互联网 发布:淘宝女装分类宝贝图片 编辑:程序博客网 时间:2024/05/16 18:03
name = getArguments().getString("name");if (name.equals("头条")){ name = "toptiao";}else if (name.equals("军事")){ name = "junshi";}else if (name.equals("时尚")){ name = "shishang";}else if (name.equals("财经")){ name = "caijing";}else if (name.equals("国内")){ name = "guonei";}else if (name.equals("国际")){ name = "guoji";}else if (name.equals("体育")){ name = "tiyu";}else if (name.equals("娱乐")){ name = "yule";}//自定义一个方法getshuju(name);
//-------------方法
private void getshuju(final String name) { AsyncTask<Void, Void, String> asyncTask = new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void... voids) { try { URL url = new URL("http://v.juhe.cn/toutiao/index?type="+name+"&key=c4479ad58f41e7f78a8fa073d0b1f1b5"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setReadTimeout(5000); connection.setConnectTimeout(5000); //获取 int responseCode = connection.getResponseCode(); if (responseCode == 200){ InputStream inputStream = connection.getInputStream(); String json = streamToString(inputStream,"utf-8"); //打印字符串 Log.i("---",json); return json; } } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String s) { Gson gson = new Gson(); DataDataBean dataDataBean = gson.fromJson(s, DataDataBean.class); list1.addAll(dataDataBean.getResult().getData()); if (myAdapter==null){ myAdapter = new MyAdapter(getActivity(),list1); xlv.setAdapter(myAdapter); }else { myAdapter.notifyDataSetChanged(); } xlv.stopLoadMore(); } }; asyncTask.execute();}
阅读全文
0 0
- A联合之bundle传值在xlistview中获取
- XListView在activity中HttpURLConnection请求数据
- 在Activity之间传值,遍历Bundle
- Android中Intent与Bundle 在传值时有什么不同
- Android中Intent与Bundle 在传值时有什么不同
- Android中Intent与Bundle 在传值时有什么不同
- Android中Intent与Bundle 在传值时有什么不同
- Android中Intent与Bundle 在传值时有什么不同
- Android中Intent与Bundle 在传值时有什么不同
- 在OSGi container中运行bundle时无法获取derby的数据库连接
- Android中使用Bundle页面传值
- A联合布局之Tab导航
- 在XlistView中插入ViewPager作为头布局
- 如何在Xcode中封装.Bundle文件
- 在Apache Felix中运行bundle
- 在Eclipse中开发OSGi Bundle
- 关于Bundle及其在不同activity之间的传值
- 安卓类——使用Bundle在Activity之间传值
- LayoutInFlater原理
- 【项目经理之修炼(6)】《基础篇》项目经理应该坐在哪儿?
- shell脚本归纳总结(二)
- python3 读取写入Excel
- eclipse导包和maven导包、lombok包
- A联合之bundle传值在xlistview中获取
- Appium+python+Android 计算器case
- 简单的html静态网页使用libevent
- svg动态添加事件
- 【项目经理之修炼(7)】《基础篇》人生游戏中的神器——谦虚
- 【EmguCv】人脸/人眼检测
- 达达租车系统(java)
- ffmpeg实现实时录音并推流的功能
- 可能是东半球最全的RxJava使用场景小结