Как правильно обрабатывать изменения ориентации экрана в 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