I try open camera following way:
...
private void runCamera() {
String storageState = Environment.getExternalStorageState();
if (storageS
onDestroy is not guaranteed to be executed on any android version, if it does you should do something quick and return
also see this Activity OnDestroy never called?
Actually the camera causes the orientation change in your activity that is why your activity is being destroyed and recreated.
Add this in your manifest file it will prevent the orientation change and your activity will not get destroyed and recreated.
<activity
android:name=".YourActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait" >
</activity>
Activity killed / onCreate called after taking picture via intent
onDestroy
is not guaranteed to be called. Make sure you save persistent state in onPause
rather than onStop
and onDestroy
. You should never rely on either onStop
or onDestroy
to be called.