专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Android

Android 树形菜单有关问题

发布时间:2010-05-30 10:57:08 文章来源:www.iduyao.cn 采编人员:星星草
Android 树形菜单问题
我现在做的是一个树形菜单,就和书的目录差不多,效果出来了,就是中间处理事件时出了点问题:

我点定义了一个list,用来存放一级目录:
private List<Map<String,String>> list = new ArrayList<Map<String,String>>();

然后又定义了一个ChildList,用来存放二级目录:
private List<List<Map<String, String>>> childList = new ArrayList<List<Map<String, String>>>();

在数据库中查询的目录分别放在list、childList中,然后通过
mAdapter = new SimpleExpandableListAdapter(this,list,R.layout.list_mulu,from,to,childList,R.layout.list_mulu,from,to);
expandableList.setAdapter(mAdapter);
加载到ExpandableListView中。

问题是,还有三级目录,当我点击二级目录,触发事件时,将三级目录的内容显示出来,当三级目录显示出来后,我再点二级目录重新获取三级目录时就报错了:
“The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not nodified from a background thread.but only from the UI thread”

我用adapter.getCount()取值测了一下,可能还有线程在跑,更新了mAdapter.getCount();的返回值
但不知道如何处理一下,希望大家多多指教!


------解决方案--------------------
adapter.notifyDataSetChanged
------解决方案--------------------
那判断三级菜单是不是打开的。。。
true就不做处理?
再点二级目录应该是关闭二级目录才对啊,是不是我理解错了?
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: