【转载】cannot be cast…
来源:互联网 发布:c语言经典书籍推荐 编辑:程序博客网 时间:2024/06/05 08:07
原文地址:cannot be cast toandroid.widget.HeaderViewListAdapter
cannot be cast to android.widget.HeaderViewListAdapter
用listview设置header或footerview,通常发生该异常。
如果你没有发生,那是碰巧。但是你可能不知道原因。
如果在listview.setAdapter(adapter)方法之后
即addHeaderView或
那么在你listView.removeHearderView或removeFooterView时就会报该异常。
在Listview的源码中如果设置了adapter,那么它会强转成HeaderViewListAdapter,所以就会报错。
if
}
。
所以你一定要在setAdapter之前调用addHeaderView或addFooterVeiw. 0 0
- 【转载】cannot be cast…
- 解决:Some characters cannot be …
- Httpservlet cannot be&…
- the import ** cannot be resolve…
- jsp中Book cannot be resolved to …
- factorOne cannot be&nb…
- [原]silktest "Window cannot be s…
- Can not cast from List…
- How to be a …
- Visual Studio Express Edition Be…
- Cannot send session cache limite…
- 1577 – Cannot proceed beca…
- Cannot send session cache limite…
- Cannot start session without err…
- Why ASMLIB and why not? <转载…
- My Favorate Websites ( to be upd…
- A temporary table could not be c…
- Be Tough
- 【转载】获取Android设备挂载的所…
- 【转载】Android开源框架Universal…
- 【转载】关于Vitamio的播放视频使…
- 25-TCP 协议(慢启动——观察)
- 【转载】Android 特殊的单例T…
- 【转载】cannot be cast…
- 【转载】理解Fragment生命周期
- log4j.properties配置详解与…
- linux 查看应用程序进程号、端口
- Xamarin XAML语言教程对象元素的声明方式
- 【转载】android.graphics.Paint方…
- 【转载】Mybatis使用MySQL模糊查询…
- 蚁群算法
- 解决Android中Handler警告、…