在xml 文件里设置了 onclick ,然后又在mainactivity 里面 findViewById 找了按钮,点击后出现
闪退, 后面试了一下又可以
08-17 15:25:50.686: E/AndroidRuntime(2203): FATAL EXCEPTION: main
08-17 15:25:50.686: E/AndroidRuntime(2203): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ex00_example/com.example.ex00_example.SecondActivity}: java.lang.ClassCastException: android.widget.RadioGroup cannot be cast to android.widget.Button
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.os.Handler.dispatchMessage(Handler.java:99)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.os.Looper.loop(Looper.java:137)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.app.ActivityThread.main(ActivityThread.java:4745)
08-17 15:25:50.686: E/AndroidRuntime(2203): at java.lang.reflect.Method.invokeNative(Native Method)
08-17 15:25:50.686: E/AndroidRuntime(2203): at java.lang.reflect.Method.invoke(Method.java:511)
08-17 15:25:50.686: E/AndroidRuntime(2203): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-17 15:25:50.686: E/AndroidRuntime(2203): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-17 15:25:50.686: E/AndroidRuntime(2203): at dalvik.system.NativeStart.main(Native Method)
08-17 15:25:50.686: E/AndroidRuntime(2203): Caused by: java.lang.ClassCastException: android.widget.RadioGroup cannot be cast to android.widget.Button
08-17 15:25:50.686: E/AndroidRuntime(2203): at com.example.ex00_example.SecondActivity.onCreate(SecondActivity.java:25)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.app.Activity.performCreate(Activity.java:5008)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
08-17 15:25:50.686: E/AndroidRuntime(2203): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
08-17 15:25:50.686: E/AndroidRuntime(2203): ... 11 more