在调程序时总是出现异常关闭的现象,log显示:

03-26 07:58:09.528: E/AndroidRuntime(398): Caused by: java.lang.ClassCastException: android.widget.ImageButton

XML中:

JAVA文件中:

解决方法:

把两个控件类型改成一致的就可以了。

java.lang.ClassCastException: android.widget.ImageButton异常处理的更多相关文章

  1. java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView

    最近在学习drawerLayout时,遇到这个bug.如下示: java.lang.ClassCastException: android.widget.RelativeLayout cannot b ...

  2. java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText

    Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.Ed ...

  3. 安卓出现错误: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText

    Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.Ed ...

  4. java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams

    java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.w ...

  5. java.lang.ClassCastException:android.widget.Button cannot be cast to android.widget.ImageView

    今天遇到一个错误也不知道怎么回事,上网搜了一下: 出现的问题是:java.lang.ClassCastException:android.widget.Button cannot be cast to ...

  6. java.lang.ClassCastException android.widget.RelativeLayout LayoutParams 异常

    1.在xml布局文件如下所示: <RelativeLayout android:layout_width="match_parent" android:layout_heig ...

  7. Exception: java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams

    RelativeLayout title_bg = (RelativeLayout)FTU_Bluetooth.this.findViewById(R.id.titlebar); LinearLayo ...

  8. Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams

    最近,在android中用代码动态改变某种布局(组件)的高度时,会遇到如题所示的类转换异常.上网查了一下,如下所示: These supply parameters to the parent of ...

  9. Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView异常解决

    有时在修改xml文件时,全报这种错误,这个应该是缓存没得到及时更新导致的,可以通过以下方法解决: Eclipse tends to mess up your resources every now a ...

随机推荐

  1. python自学笔记(一)

    我没学过python,通过网上和一些图书资料,自学并且记下笔记. 很多细节留作以后自己做项目时再研究,这样能更高效一些. python基础自学笔记 一.基本输入和输出 pthon3.0用input提示 ...

  2. Python学习笔记(二十五)操作文件和目录

    摘抄:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/0014319253241 ...

  3. Packet Tracer 5.0 构建CCNA实验(3)—— 路由器实现vlan间通信

    --交换机配置 --交换机和路由器连接的接口 switchport mode trunk --路由器配置 enable conf t int fa0/0.1 --路由器接口的子接口 encapsula ...

  4. ⑤ 设计模式的艺术-05.原型(Prototype)模式

    场景 思考一下:克隆技术是怎么样的过程? 克隆羊多利大家还记得吗? javascript语言中的,继承怎么实现?那里面也有prototype,大家还记得吗? 原型模式 通过new产生一个对象需要非常繁 ...

  5. amcharts的一些用法

    function chartdiv2() { var chart; var chartData = [ { "month" : "2015-08", " ...

  6. fetch and js异步介绍

    http://www.ruanyifeng.com/blog/2012/12/asynchronous%EF%BC%BFjavascript.html   Javascript异步编程的4种方法 ht ...

  7. HDU 2593 Pirates’ Code (STL容器)

    题目链接 Problem Description Davy Jones has captured another ship and is smiling contently under the sun ...

  8. Mac 10.9x下安装配置phonegap3.0开发环境 (涉及android sdk配置)

    最近突然想弄一下phonegap,之前一直是听说,没亲自配置开发过.结果配置过程非常艰难啊.特别是android平台的配置,那叫一个麻烦,网上搜了半天都没找到非常好的资料.文章也都是抄来抄去,最烦的就 ...

  9. Hive ORC表的使用

    创建普通临时表: create table if not exists test_orc_tmp(   name string,   gender string,   cnt BIGINT )row ...

  10. apache2启动失败(Failed to start The Apache HTTP Server.)解决方案

    不知道如何启动apache2就启动不来了. 如下图所示: 即使卸载了重新装也是如此 经过测试卸载并清除软件包的配置即可解决 sudo apt-get purge apache2  sudo apt-g ...