cannot be cast to android.widget.HeaderViewListAdapter
来源:互联网 发布:手机淘宝怎样退货流程 编辑:程序博客网 时间:2024/05/01 10:41
cannot be cast to android.widget.HeaderViewListAdapter
用listview设置header或footerview,通常发生该异常。
如果你没有发生,那是碰巧。但是你可能不知道原因。
如果在listview.setAdapter(adapter)方法之后
即addHeaderView或
那么在你listView.removeHearderView或removeFooterView时就会报该异常。
在Listview的源码中如果设置了adapter,那么它会强转成HeaderViewListAdapter,所以就会报错。
if
}
。
所以你一定要在setAdapter之前调用addHeaderView或addFooterVeiw.
转自:http://blog.sina.com.cn/s/blog_48964b120101pkrf.html
0 0
- 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
- putty psftp连接到腾讯云服务器
- 怎么理解CPU与显卡的关系
- Layer3 ACL
- 在64位系统以及64位编译器下字节对齐----阿里巴巴2015实习生笔试题
- CodeIgniter 数据库连接查询
- cannot be cast to android.widget.HeaderViewListAdapter
- shared_ptr 真的非常的有用
- 常规功能和模块自定义系统 (cfcmms)—053把一对多(OneToMany)字段的grid加入到form中
- APK瘦身记,如何实现高达53%的压缩效果
- linux原始套接字(1)-arp请求与接收
- swift 柯里化(示例通知事件)
- [Leetcode]235. Lowest Common Ancestor of a Binary Search Tree
- 安装Tomcat后的环境变量设置
- Android OkHttp(1)