在调程序时总是出现异常关闭的现象,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. TCP/IP地址格式转换API

    1.htonl ()和ntohl( )  ntohl( )-----网络顺序转换成主机顺序(长整型) u_long PASCAL FAR ntohl (u_long netlong); htonl ( ...

  2. 跟我一起写Makefile(五)

    使用变量———— 在Makefile中的定义的变量,就像是C/C++语言中的宏一样,他代表了一个文本字串,在Makefile中执行的时候其会自动原模原样地展开在所使用的地方.其与C/C++所不同的是, ...

  3. js实现数组排序

    1. JavaScript的sort()方法 var array = [1,4,-8,-3,6,12,9,8]; function compare(val1,val2){ return val1-va ...

  4. package.json文档

    之前在博客中写过一篇关于 " node.js的安装配置 " 的文章,里面有提到利用 gulp watch 来监听文档的变化.其中需要 package.json 文件才能实现效果,所 ...

  5. LightOJ 1070 - Algebraic Problem 推导+矩阵快速幂

    http://www.lightoj.com/volume_showproblem.php?problem=1070 思路:\({(a+b)}^n =(a+b){(a+b)}^{n-1} \) \(( ...

  6. 垂直居中vertical-align

    vertical-align对一些特定显示样式(例如单元格显示方式:table-cell)的元素才会起作用. div{display:table-cell; vertical-align:middle ...

  7. 【洛谷 P2216】 [HAOI2007]理想的正方形(二维ST表)

    题目链接 做出二维\(ST\)表,然后\(O(n^2)\)扫一遍就好了. #include <cstdio> #include <cstring> #include <a ...

  8. Sublime之快捷键(二)

    1. 在使用Sublime的时候,经常用到选中文件中相同的一些字段,那怎么办呢? 快捷键: ctrl + d 可以快速的选择,你所选中的文字,每次按下该快捷键,就会自动的寻找相同的字段: Alt + ...

  9. 48、面向对象中super的作用?

    什么是super? super() 函数是用于调用父类(超类)的一个方法. super 是用来解决多重继承问题的,直接用类名调用父类方法在使用单继承的时候没问题,但是如果使用多继承,会涉及到查找顺序( ...

  10. vc6列表框多选时,获取哪些项被选中

    //vc6列表框多选时,获取哪些项被选中...... void CWebcyzDlg::OnButton2() { int n = m_mylist1.GetSelCount();//首先获取一共有多 ...