title: Activity killed / onCreate called after taking picture via intent
body: <p>I am trying to take a picture using an intent. My problem is that sometimes after taking a picture my activity, which calls startActivityForResult, seems to be destroyed so that onCreate is called again.</p>
  
  <p>Here is my code for taking pictures after clicking an imageview, which image should be replaced:</p>
  
  <pre><code>if (!getPackageManager().hasSystemFeature(
                  PackageManager.FEATURE_CAMERA)) {
              Util.makeLongToast(R.string.lang_no_camera);
          } else {
              Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
              startActivityForResult(intent, TAKE_ITEM_PHOTO);
          }
  </code></pre>
  
  <p>...</p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      Log.v(TAG, "onactivityresult called");
      if (requestCode == TAKE_ITEM_PHOTO) {
          if (data != null) {
  
              imageUri = data.getData();
  
  
                  try {
                      img_photo.setImageBitmap(Media.getBitmap(
                              getContentResolver(), imageUri));
              } catch (FileNotFoundException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  } catch (IOException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
  
          } else
              Log.w(TAG, "data is null");
      }
  }
  </code></pre>
  
  <p>So all i try is to take a picture and replace the image of an imageview with it. But in some cases onCreate is called after onActivityResult was called and the new image is lost.</p>
  
  <p>Help is greatly appreciated.</p>