widget.Button cannot be cast to android.widget.ListView
2015-04-14 20:42
399 查看
04-14 12:37:43.696: E/AndroidRuntime(1963): FATAL EXCEPTION: main
04-14 12:25:07.227: E/AndroidRuntime(1691): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android_robot_01_app/com.android_robot_01_app.MainActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.ListView
04-14 12:37:43.696: E/AndroidRuntime(1963): java.lang.IllegalStateException: Could not find a method recordMessage(View) in the activity class com.android_robot_01_app.MainActivity for onClick handler on view class android.widget.Button with id 'id_chat_record'
04-14 12:37:43.696: E/AndroidRuntime(1963): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
如上报了一堆错,其实就是布局问题,关键问题:android.widget.Button cannot be cast to android.widget.ListView
因为我也是初学,在一层一层的线性布局中,唯独没有给listview加入线性布局里,导致这个问题
如果谁有这种问题,查看一下,哪个控件没有加布局
04-14 12:25:07.227: E/AndroidRuntime(1691): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android_robot_01_app/com.android_robot_01_app.MainActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.ListView
04-14 12:37:43.696: E/AndroidRuntime(1963): java.lang.IllegalStateException: Could not find a method recordMessage(View) in the activity class com.android_robot_01_app.MainActivity for onClick handler on view class android.widget.Button with id 'id_chat_record'
04-14 12:37:43.696: E/AndroidRuntime(1963): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
如上报了一堆错,其实就是布局问题,关键问题:android.widget.Button cannot be cast to android.widget.ListView
因为我也是初学,在一层一层的线性布局中,唯独没有给listview加入线性布局里,导致这个问题
如果谁有这种问题,查看一下,哪个控件没有加布局
相关文章推荐
- LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- android用Adapter实现ListView的初始化报错android.widget.LinearLayout cannot be cast to android.widget.TextView
- java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutPara
- 安卓出现android.widget.TextView cannot be cast to android.widget.Button问题
- android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- 解决 android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- ListView的一个典型crash cannot be cast to android.widget.AbsListView$LayoutParams
- 关于java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.Edit 错误的解决
- APP程序崩溃错误为Android.widget,textView cannot be cast to android.widget.button
- java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- 错误android.widget.ImageButton cannot be cast to android.widget.Button
- android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- Android 获取listview中的文本 报错:android.widget.LinearLayout cannot be cast to android.widget.TextView
- java.lang.ClassCastException~android.widget.ImageView cannot be cast to android.widget.Button~
- 关于Android.widget.Button cannot be cast to com.esri.android.map.MapView错误的问题
- java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.wid
- com.baoyz.swipemenulistview.SwipeMenuListView$1 cannot be cast to android.widget.BaseAdapter
- android.widget.Button cannot be cast to android.widget.Gallery
- Android 解决bug:异常提示"ListView cannot be cast to android.widget.BaseAdapter "
- android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams