simpleAdapter不刷新是为什么

哈哈gogo 2014-04-16 09:55:09
我用的是 simpleAdapter,不是自定义的,我重新命名文件后, simpleAdapter.notifyDataSetChanged(); 没有刷新listview这是为什么,网上查过有的是要自定义adapter,难道这个必须要自定义一个,应该不是必须的吧,望高手来指点一下,
...全文
229 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
sukurax 2015-07-08
  • 打赏
  • 举报
回复
我去,说一下解决方法啊
hai_chong123 2015-06-26
  • 打赏
  • 举报
回复
自己解决完了不说方法
hai_chong123 2015-06-26
  • 打赏
  • 举报
回复
这样的楼主真操蛋,下次有不用告诉他!
AS3326467 2015-01-08
  • 打赏
  • 举报
回复
楼主怎么解决的,没说呀?
TonyZlg 2014-07-14
  • 打赏
  • 举报
回复
楼主是怎么解决的?自定义adapter?
酒比花香 2014-04-17
  • 打赏
  • 举报
回复
贴出代码来让大家看看
映映 2014-04-17
  • 打赏
  • 举报
回复
是不是数据没有变化啊
绝世酱油瓶 2014-04-17
  • 打赏
  • 举报
回复
重新命名文件? 贴下你的代码看看。
  • 打赏
  • 举报
回复
你在哪里调用的notifyDataSetChanged?
哎,真难 2014-04-17
  • 打赏
  • 举报
回复
simpleAdapter里面的内容要修改啊,
哈哈gogo 2014-04-17
  • 打赏
  • 举报
回复
自己解决了,谢谢各位,还有楼上赚 积分的
哈哈gogo 2014-04-17
  • 打赏
  • 举报
回复
楼上的难道是来赚积分的
吴小辉 2014-04-17
  • 打赏
  • 举报
回复
下面是调用的代码片段 new AlertDialog.Builder(this).setTitle("重命名") .setView(input).setPositiveButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String newfilename = input.getText().toString(); Map<String, Object> itempath =listItemsPath.get(selectedPosition); File file = new File((String) itempath.get("filePath")); String newFilePath = file.getParent(); File newFile = new File(newFilePath+"/"+newfilename); try{ if(file.renameTo(newFile)){ listItemsPath.remove(selectedPosition); simpleAdapter.notifyDataSetChanged(); // simpleAdapter.notifyDataSetChanged(); }
哈哈gogo 2014-04-17
  • 打赏
  • 举报
回复
下面是调用的代码片段 new AlertDialog.Builder(this).setTitle("重命名") .setView(input).setPositiveButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String newfilename = input.getText().toString(); Map<String, Object> itempath =listItemsPath.get(selectedPosition); File file = new File((String) itempath.get("filePath")); String newFilePath = file.getParent(); File newFile = new File(newFilePath+"/"+newfilename); try{ if(file.renameTo(newFile)){ listItemsPath.remove(selectedPosition); simpleAdapter.notifyDataSetChanged(); // simpleAdapter.notifyDataSetChanged(); }
哈哈gogo 2014-04-17
  • 打赏
  • 举报
回复
引用 5 楼 jack_wolf_ 的回复:
是不是数据没有变化啊
数据是有变化的,这个我确定
哈哈gogo 2014-04-17
  • 打赏
  • 举报
回复
引用 3 楼 hjywyj 的回复:
你在哪里调用的notifyDataSetChanged?
我是在当按下确定按钮后调用的,输入完文件名,按确定
Johnny-xz 2014-04-16
  • 打赏
  • 举报
回复
这个事需要的是一个集合类,是不是哪写错了。能贴代码吗

80,349

社区成员

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

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