1

I am using android:configChanges="orientation|keyboardHidden" in menifest. But still its refresh my activity. Here is my activity tag in menifest.

<activity
    android:name="com.paksoft.people.MiActivity"
    android:label="@string/app_name"
    android:configChanges="orientation|keyboardHidden"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustPan" >
</activity>
Muhammad Aamir Ali
  • 20,419
  • 10
  • 66
  • 57

1 Answers1

0

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.

Community
  • 1
  • 1
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307