当我运行我的应用程序并从我的微调器中选择一个项目而不是像应用程序崩溃那样打开一个新类时遇到问题,我想知道是否有人可以帮助我解决为什么会发生这种情况。我不确定要包含代码的哪一部分,所以我将包含 Logcat,如果您请求任何代码,我将编辑这篇文章。
谢谢。
日志猫:
03-09 15:36:53.814: E/AndroidRuntime(13429): FATAL EXCEPTION: main
03-09 15:36:53.814: E/AndroidRuntime(13429): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.famouspeople/com.example.famouspeople.SeanConnery}: java.lang.NullPointerException
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.access$600(ActivityThread.java:140)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.os.Looper.loop(Looper.java:137)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.main(ActivityThread.java:4898)
03-09 15:36:53.814: E/AndroidRuntime(13429): at java.lang.reflect.Method.invokeNative(Native Method)
03-09 15:36:53.814: E/AndroidRuntime(13429): at java.lang.reflect.Method.invoke(Method.java:511)
03-09 15:36:53.814: E/AndroidRuntime(13429): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
03-09 15:36:53.814: E/AndroidRuntime(13429): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
03-09 15:36:53.814: E/AndroidRuntime(13429): at dalvik.system.NativeStart.main(Native Method)
03-09 15:36:53.814: E/AndroidRuntime(13429): Caused by: java.lang.NullPointerException
03-09 15:36:53.814: E/AndroidRuntime(13429): at com.example.famouspeople.SeanConnery.initialize(SeanConnery.java:44)
03-09 15:36:53.814: E/AndroidRuntime(13429): at com.example.famouspeople.SeanConnery.onCreate(SeanConnery.java:28)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.Activity.performCreate(Activity.java:5206)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
03-09 15:36:53.814: E/AndroidRuntime(13429): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
03-09 15:36:53.814: E/AndroidRuntime(13429): ... 11 more