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加入线性布局里,导致这个问题
如果谁有这种问题,查看一下,哪个控件没有加布局