cannot be cast to android.widget.HeaderViewListAdapter
来源:互联网 发布:淘宝关键词广告位价格 编辑:程序博客网 时间:2024/05/01 15:11
cannot be cast to android.widget.HeaderViewListAdapter
用listview设置header或footerview,通常发生该异常。
如果你没有发生,那是碰巧。但是你可能不知道原因。
如果在listview.setAdapter(adapter)方法之后 添加头或尾view,
即addHeaderView或 addFooterView,
那么在你listView.removeHearderView或removeFooterView时就会报该异常。
在Listview的源码中如果设置了adapter,那么它会强转成HeaderViewListAdapter,所以就会报错。
if (mAdapter != null && ((HeaderViewListAdapter) mAdapter).removeHeader(v)) {
if (mDataSetObserver != null) {
mDataSetObserver.onChanged();
}
result = true;
}
。
所以你一定要在setAdapter之前调用addHeaderView或addFooterVeiw.- 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
- Tomcat内存设置
- Asp.Net里面调用Microsoft Excel Application DCOM问题终极解决方法
- 黑马课上的 Http操作类
- 铁路订票系统的简单设计
- C# ListView用法详解
- cannot be cast to android.widget.HeaderViewListAdapter
- 为 iPhone 应用搭建 php 版 push 服务器的流程
- POJ 2676 Sudoku
- asp.net调用浏览器右键菜单“另存为”
- Oracle Redo Log 机制 小结
- !!!!101老人死而复生
- 刘汝佳新白书 第二章 数学基础 开篇讲解 关于各种排列组合
- Linux安装 oracle 11g r2
- C# 反射机制