Activity gets killed while executing the camera intent

OK, I found the problem. The issue was not so much that the activity was being killed, but that it was not being restored. I realized that this can happen when your activity is declared in the manifest with android:noHistory="true". So the activity was removed from the stack upon being killed, and the previous activity was shown instead.

After I removed the noHistory parameter, the activity started appearing again after using the camera.


I guess the problem is 1) in your custom implementation of exception handler and 2) this line:

intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(picFile));
  1. Your exception handler implementation doesn't allow you to see the NullPointerException which is thrown in onActivityResult method when you try to access the data from the Intent returned.
  2. It seems to be a bug which prevents Intent from being passed to onActivityResult method if an output file has been put as an extra to the Intent starting camera Activity.

Try removing the line and see if your Activity is recreated when camera Activity has been finished.