It's possible that launching of ACTION_IMAGE_CAPTURE
intent will push your activity out of memory. See for example: Android startCamera gives me null Intent and ... does it destroy my global variable?
In this situation, onCreate()
of your activity is called before onActivityResult()
. You should prepare your activity to reinitialize itself, probably using onSaveInstanceState(Bundle)
.
Note that the decision whether to shut down the activity, or keep it in background, depends on the overall system state that is beyond your control.
PS: android:configChanges
attribute is irrelevant because the activity is destroyed not as response of the system to orientation switch (and this cannot happen with android:screenOrientation="portrait"
), but because the system resources are drained by launching the Camera app to fullfill the ACTION_IMAGE_CAPTURE
intent.