上拉下拉分页加载
来源:互联网 发布:淘宝打假新规则 编辑:程序博客网 时间:2024/04/27 18:57
第三方登录获取授权
Platform platform11 = ShareSDK.getPlatform(QQ.NAME);// platform11.SSOSetting(true);platform11.authorize();platform11.showUser(null);// 必须要加的要不然不行!这个才是授权的!tm = (TelephonyManager) MainActivity.this .getSystemService(TELEPHONY_SERVICE);imi = tm.getDeviceId();platform11.setPlatformActionListener(new PlatformActionListener() {@Overridepublic void onError(Platform platform11, int arg1, Throwable arg2) { // 弹出失败窗口}public void onComplete(Platform platform11, int arg1, HashMap<String, Object> arg2) { System.out.println("登录成功。。。。"); //得到用户信息 String userId = platform11.getDb().getUserId(); String userName = platform11.getDb().getUserName(); String token = platform11.getDb().getToken(); String icon = platform11.getDb().getUserIcon();//用户头像 long expiresTime = platform11.getDb().getExpiresTime(); SimpleDateFormat sdf3 = new SimpleDateFormat( "yyyy-MM-dd HH:mm"); System.out.println("userId " + userId); System.out.println("userName " + userName); System.out.println("token " + token); System.out.println("icon " + icon); System.out.println("expiresTime " + sdf3.format(expiresTime)); //跳转页面传值 Intent intent = new Intent(getApplicationContext(), ShowActivity.class); //传用户名和头像 intent.putExtra("name", userName); intent.putExtra("image", icon); startActivity(intent); } @Override public void onCancel(Platform arg0, int arg1) { } });
请求网络数据上拉刷新下拉加载进行分页操作
private void getinfo(final String str) { new AsyncTask<Void, Void, List<nList>>() { @Override protected List<nList> doInBackground(Void... params) { //i代表页数 String path = "http://api.sina.cn/sinago/list.json?channel=hdpic_funny&adid=4ad30dabe134695c3b7c3a65977d7e72&wm=b207&from=6042095012&chwm=12050_0001&oldchwm=12050_0001&imei=867064013906290&uid=802909da86d9f5fc&p=" + i; // 得到请求的数据 String string = MyHttp.getHttp(path); Gson gson = new Gson(); Type type = new TypeToken<News>() { }.getType(); News news = gson.fromJson(string, type); Data data = news.data; List<nList> list = data.list; return list; } @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected void onPostExecute(List<nList> result) { super.onPostExecute(result); //调用方法的时候判断是上拉还是下拉,上拉加载新的数据到集合顶部,下拉加载新的数据到集合中 if (str.equals("刷新")) { listall.addAll(0, result); } else { listall.addAll(result); } //添加适配器 setadapter(); } private void setadapter() { //在添加适配器时候,判断是否创建了适配器,如果适配器创建,直接适配器更新,否则创建适配器 if (adapter == null) { adapter = new Myadapter(ShowActivity.this, listall); listView.setAdapter(adapter); } else { adapter.notifyDataSetChanged(); } } }.execute();}
上拉刷新方法
@Overridepublic void onRefresh() { handler.postDelayed(new Runnable() { @Override public void run() { i = i + 1; getinfo("刷新"); load(); } }, 2000);}
下拉加载的方法
@Overridepublic void onLoadMore() { handler.postDelayed(new Runnable() { @Override public void run() { i = i + 1; getinfo("加载"); load(); } }, 2000);}
2 0
- 上拉下拉分页加载
- 上拉下拉加载
- html5上拉下拉刷新分页实现
- android上拉下拉加载更多数据
- PullToRefresh修改上拉下拉加载动画
- Android 上拉下拉加载PullToRefreshLayout
- 上拉下拉加载数据的应用.....
- XRecyclerView的上拉下拉加载数据
- Android pulltorefresh上拉下拉刷新加载
- Android_XRecyclerView上拉下拉加载数据
- pulltorefresh(上拉下拉加载数据) 使用方法!
- pulltorefresh(上拉下拉加载数据) 使用方法!
- Android_XRecyclerView上拉下拉加载数据
- Android_XRecyclerView上拉下拉加载数据
- Android_XRecyclerView上拉下拉加载数据
- IOS 处理分页数据的上拉下拉刷新
- 上拉下拉电阻
- spi 上拉下拉
- Dubbo Zookeeper与Spring或者struts2整合和使用
- 6月30日笔记
- 两种方法实现在HTML页面加载完毕后运行
- 高并发系统设计
- radioGroup动态加载radiobutton且radiobutton没有button圆圈按钮
- 上拉下拉分页加载
- 如何通过插件携带第二个单据体到下游单据
- printf打印是字体和背景带颜色的输出的方法
- Android实训案例(七)——四大组件之一Service初步了解,实现通话录音功能,抽调接口
- Java学习2
- 项目中Gson解析的上拉加载下拉刷新(HttpUtils)
- 48. Rotate Image ---leetcode算法笔记
- 4.php设计模式:状态模式的使用场景
- [Leetcode]225. Implement Stack using Queues