Changing orientation breaks the whole thing


#1

Hey guys, been running into a lot of trouble with this code. It works perfectly fine as long as I keep the phone in portrait. If I rotate it at all it loses all the saved pictures. With CrimeFragment active, if I rotate to landscape it wipes the picture but the app remains running, but if I rotate it back it all falls apart. The error text freaks out that mPhotoView is null, which is confusing to me. mPhotoView should never be null as onCreateView should find it every time. 09-18 23:51:32.811 17960-17960/com.schmidtmark.android.criminalintent E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.schmidtmark.android.criminalintent, PID: 17960 java.lang.RuntimeException: Unable to stop activity {com.schmidtmark.android.criminalintent/com.schmidtmark.android.criminalintent.CrimePagerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.widget.ImageView.getDrawable()' on a null object reference

If anyone’s found a solution for this, I’d be eternally grateful. Seriously so desperate at this point.