我的应用在纵向模式下效果很好。当我使用横向模式并执行任何活动时,它会强制关闭。日志表示空指针异常。我通过消息来源验证了所有信息都传递良好,但强行关闭。
日志:
10-24 17:14:38.566: E/AndroidRuntime(3684): FATAL EXCEPTION: main
10-24 17:14:38.566: E/AndroidRuntime(3684): java.lang.RuntimeException: Unable to start activity ComponentInfo{/app.UserPage}: java.lang.NullPointerException
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.access$600(ActivityThread.java:162)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.os.Handler.dispatchMessage(Handler.java:107)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.os.Looper.loop(Looper.java:194)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.main(ActivityThread.java:5371)
10-24 17:14:38.566: E/AndroidRuntime(3684): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 17:14:38.566: E/AndroidRuntime(3684): at java.lang.reflect.Method.invoke(Method.java:525)
10-24 17:14:38.566: E/AndroidRuntime(3684): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
10-24 17:14:38.566: E/AndroidRuntime(3684): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
10-24 17:14:38.566: E/AndroidRuntime(3684): at dalvik.system.NativeStart.main(Native Method)
10-24 17:14:38.566: E/AndroidRuntime(3684): Caused by: java.lang.NullPointerException
10-24 17:14:38.566: E/AndroidRuntime(3684): at app.UserPage.onCreate(UserPage.java:219)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.Activity.performCreate(Activity.java:5122)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
10-24 17:14:38.566: E/AndroidRuntime(3684): ... 11 more