I want to set my profile image using the camera, but my `Activity` is killed sometimes when `startActivityForResult` with `ACTION_IMAGE_CAPTURE`.

camera run successfully, i can take picture.

but when i press save button after take picture, sometimes my activity is restarted.

How can I solve this problem? Please help me!

Here is my code:

```
i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, 
           Uri.fromFile(new File(getExternalFilesDir(null).getPath() + "/profile.png")));

startActivityForResult(i, which);

```

Thank you.