如何正確處理屏幕方向更改在android中?ANDROID屏幕方向更改
任何人都可以幫我解決這個問題嗎?
我總是得到這樣的錯誤:
05-12 07:20:38.223: ERROR/AndroidRuntime(410): FATAL EXCEPTION: main
05-12 07:20:38.223: ERROR/AndroidRuntime(410): java.lang.RuntimeException: Unable to destroy activity {com.loginpage/com.loginpage.MainActivity}: java.lang.NullPointerException
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3655)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3673)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3789)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.app.ActivityThread.access$2400(ActivityThread.java:125)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2037)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.os.Handler.dispatchMessage(Handler.java:99)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.os.Looper.loop(Looper.java:123)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at java.lang.reflect.Method.invokeNative(Native Method)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at java.lang.reflect.Method.invoke(Method.java:521)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at dalvik.system.NativeStart.main(Native Method)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): Caused by: java.lang.NullPointerException
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at com.loginpage.MainActivity.storePreferences(MainActivity.java:80)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at com.loginpage.MainActivity.onDestroy(MainActivity.java:29)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3642)
05-12 07:20:38.223: ERROR/AndroidRuntime(410): ... 12 more
您使用的是「服務」還是「光標」? – 2011-05-12 07:30:28