Java:在 android SDK 中如何从方法中的另一个类调用onCreate()
方法?
日志猫:
08-28 22:27:24.152: W/dalvikvm(13642): threadid=1: thread exiting with uncaught exception (group=0x40015578)
08-28 22:27:24.156: E/AndroidRuntime(13642): FATAL EXCEPTION: main
08-28 22:27:24.156: E/AndroidRuntime(13642): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.valgriz.high.low/com.valgriz.high.low.Game}: java.lang.NullPointerException
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.os.Handler.dispatchMessage(Handler.java:99)
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.os.Looper.loop(Looper.java:130)
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.app.ActivityThread.main(ActivityThread.java:3687)
08-28 22:27:24.156: E/AndroidRuntime(13642): at java.lang.reflect.Method.invokeNative(Native Method)
08-28 22:27:24.156: E/AndroidRuntime(13642): at java.lang.reflect.Method.invoke(Method.java:507)
08-28 22:27:24.156: E/AndroidRuntime(13642): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
08-28 22:27:24.156: E/AndroidRuntime(13642): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
08-28 22:27:24.156: E/AndroidRuntime(13642): at dalvik.system.NativeStart.main(Native Method)
08-28 22:27:24.156: E/AndroidRuntime(13642): Caused by: java.lang.NullPointerException
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.app.Activity.findViewById(Activity.java:1647)
08-28 22:27:24.156: E/AndroidRuntime(13642): at com.valgriz.high.low.Package.runThis(Package.java:16)
08-28 22:27:24.156: E/AndroidRuntime(13642): at com.valgriz.high.low.Game.onCreate(Game.java:34)
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-28 22:27:24.156: E/AndroidRuntime(13642): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
08-28 22:27:24.156: E/AndroidRuntime(13642): ... 11 more