我将以下代码放入 manifest.xml
<activity android:name="CPohonApp" android:configChanges="keyboardHidden|orientation"></activity>
这是我活动中的代码
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
但是当我旋转时应用程序仍然崩溃。
为什么会这样?
我使用 Android 2.3.3 API 10
谢谢你
编辑
这是我的原木猫
09-25 14:36:31.351: E/AndroidRuntime(334): FATAL EXCEPTION: main
09-25 14:36:31.351: E/AndroidRuntime(334): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.hdte.sawit/org.hdte.sawit.pohon.CPohonApp}: java.lang.NullPointerException
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2832)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.access$1600(ActivityThread.java:117)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.os.Handler.dispatchMessage(Handler.java:99)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.os.Looper.loop(Looper.java:123)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-25 14:36:31.351: E/AndroidRuntime(334): at java.lang.reflect.Method.invokeNative(Native Method)
09-25 14:36:31.351: E/AndroidRuntime(334): at java.lang.reflect.Method.invoke(Method.java:507)
09-25 14:36:31.351: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-25 14:36:31.351: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-25 14:36:31.351: E/AndroidRuntime(334): at dalvik.system.NativeStart.main(Native Method)
09-25 14:36:31.351: E/AndroidRuntime(334): Caused by: java.lang.NullPointerException
09-25 14:36:31.351: E/AndroidRuntime(334): at org.hdte.sawit.pohon.CPohonApp.createDialogSend(CPohonApp.java:277)
09-25 14:36:31.351: E/AndroidRuntime(334): at org.hdte.sawit.pohon.CPohonApp.onCreateDialog(CPohonApp.java:299)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Activity.onCreateDialog(Activity.java:2482)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Activity.createDialog(Activity.java:882)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Activity.restoreManagedDialogs(Activity.java:871)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Activity.performRestoreInstanceState(Activity.java:817)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1096)
09-25 14:36:31.351: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1625)
09-25 14:36:31.351: E/AndroidRuntime(334): ... 12 more