RecyclerView.Adapter notifyDataSetChanged 无效问题
来源:互联网 发布:鲨鱼网络 编辑:程序博客网 时间:2024/06/13 11:44
问题:接收到消息后调用更新界面回调,给adapter里add新数据,然后调用adapter.notifyDataSetChanged(),结果数据并没有刷新,查看log,调用notifyDataSetChanged()后,onCreateViewHolder、onBindViewHolder方法并没有执行,原因在于,后台接收到数据调用更新界面回调方法时,其实和当前Activity不在同一个线程。
在线程回调方法里:
mHandler.sendEmptyMessage(666);在Handler里面:
private Handler mHandler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message msg) { switch (msg.what){ case 666: mSendStatesAdapter.addAll(mSelectPath); break; } return false; }});
阅读全文
0 0
- RecyclerView.Adapter notifyDataSetChanged 无效问题
- RecyclerView 中adapter.notifyDataSetChanged()无效的问题
- Android问题集-RecyclerView---adapter.notifyDataSetChanged()不起作用
- Xamarin.Android Adapter NotifyDataSetChanged无效问题
- RecyclerView中Adapter调用notifyDataSetChanged无效时的解决方案
- RecyclerView.Adapter notifyDataSetChanged 不起作用
- RecyclerView.Adapter notifyDataSetChanged 不起作用
- RecyclerView.Adapter notifyDataSetChanged 不起作用
- RecyclerView---adapter.notifyDataSetChanged()不起作用
- Android adapter.notifyDataSetChanged无效
- adapter的notifyDataSetChanged()无效
- Adapter.notifyDataSetChanged()无效
- RecyclerView.notifyDataSetChanged无效
- 解决适配器(Adapter)数据更新调用 notifyDataSetChanged()无效问题
- android adapter 调用notifyDataSetChanged 无效
- 解决adapter.notifyDataSetChanged()无效
- adapter的notifyDataSetChanged()无效
- 使用RecyclerView遇到notifyDataSetChanged无效
- oracle异常处理机制
- 关于直播网站的搭建--第一步:获取直播源
- Ubuntu 14.04安装VMware tools
- lua 函数变量 assert判断
- ceres_solver
- RecyclerView.Adapter notifyDataSetChanged 无效问题
- 样式加载不出来,浏览器控制台报错:Resource interpreted as Stylesheet but transferred with MIME type text/html
- 【笔记】《WebGL编程指南》学习-第5章颜色与纹理(3-使用多幅纹理))
- File IO(NIO.2):文件操作
- Reproducing and learning new algebraic operations on word embeddings using genetic programming
- hdu 2066 一个人的旅行
- exports 和 module.exports 的区别
- nginx 配置备忘
- nginx相关