cannot be cast to android.widget.HeaderViewListAdapter
来源:互联网 发布:淘宝客鹊桥佣金 编辑:程序博客网 时间:2024/05/01 05:14
这个类型转换异常发生在ListView上,我复制别人的代码的ListView的时候,对他的代码做了一些修改,把他的HeadView去掉了,然后发生了这个错误,下面是根据日志找到的代码报错的地方:
HeaderViewListAdapter ha = (HeaderViewListAdapter) _list.getAdapter();
在这个我不能将我的ListView配置的adapter转换成HeaderViewListAdapter,原因是我去掉了原来代码的addHeaderView,导致不能正常转换,解决办法就是恢复原来代码的addHeaderView或者不使用这个转换。
另外,如果你在ListView/setAadapter(adapter)之后再addHeaderView()或者addFooterView,那么在你ListView.removeHeaderView和ListView.removeFooterView之时也会报这个异常,所以我们一样要确保自己的addHeaderView(view)和addFooterView(view)方法是在ListView.setAdapter(adapter)之前执行,切记~
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter
- android.widget.HeaderViewListAdapter cannot be cast to ***
- [android] cannot be cast to android.widget.HeaderViewListAdapter
- Error: cannot be cast to android.widget.HeaderViewListAdapter
- 奇葩问题cannot be cast to android.widget.HeaderViewListAdapter
- cannot be cast to android.widget.HeaderViewListAdapter源码分析
- java.lang.ClassCastException: android.widget.HeaderViewListAdapter cannot be cast to com.android.mms
- 异常 java.lang.ClassCastException:cannot be cast to android.widget.HeaderViewListAdapter.的解决方法
- cannot be cast toandroid.widget.HeaderViewListAdapter
- android.widget.HeaderViewListAdapter canot be cast xxxx
- android.widget.Button cannot be cast to android.widget.Gallery
- widget.Button cannot be cast to android.widget.ListView
- Media Playback//媒体播放
- 程序员七种基本技能
- 文件流输出
- 细数黑客攻击的七大战术
- Ubuntu 12.04 配置IP
- cannot be cast to android.widget.HeaderViewListAdapter
- 在Linux下使用svn co总是提示输入密码
- 求序列第K大数的部分快速排序法
- JNI开发之锅炉压力监控器
- Qt实现的简单计算器-计算简单表达式
- 排序算法(三)_计数排序、基数排序的Java实现
- js为微博内容添加话题及人员链接
- hdu 3313 (最短路)
- 将txt文档整理到excel表格中