刷新Listview数据,偶尔报错

Night999 2016-07-21 05:46:28
一、The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread。
二、数组越界

应该怎么写才能避免这些报错,有上拉刷新和下拉加载。
...全文
323 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Night999 2016-08-07
  • 打赏
  • 举报
回复
引用 3 楼 qq_16993033 的回复:
Adapter的构造方法new一个空的list,添加一个addAll方法: list.addAll(dataList); notifydatachange; 获取数据以后addAll就可以了
这样不就会有一段空白时间
小周先生 2016-07-26
  • 打赏
  • 举报
回复
Adapter的构造方法new一个空的list,添加一个addAll方法: list.addAll(dataList); notifydatachange; 获取数据以后addAll就可以了
Night999 2016-07-21
  • 打赏
  • 举报
回复
引用 1 楼 liweiying11 的回复:
解决了吗,没解决call我
暂时是这样处理的,在线程中加载数据时用另外一个List存,然后在UI线程中使用addAll添加到原List中。但还是会有问题
liweiying11 2016-07-21
  • 打赏
  • 举报
回复
解决了吗,没解决call我

80,490

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧