title: Android Camera Intent with Crop
body: <p>I've been trying to crop and resize an image while taking a picture through the camera intent but don't understand what I'm doing wrong here -- can't get the cropped image data even if the file is correctly saved on the phone.</p>
  
  <pre><code>...
  public class Add extends Activity {
      private String imageFilePath;
      ...
      protected void onCreate(Bundle savedInstanceState) {
      ...
          imageFilePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmp/" + String.valueOf(System.currentTimeMillis()) + ".jpg";
          imageFile = new File(imageFilePath);
          imageFileUri = Uri.fromFile(imageFile);
          Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
          intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri);
          intent.putExtra("crop", "true");
          intent.putExtra("outputX", 600);
          intent.putExtra("outputY", 600);
          intent.putExtra("aspectX", 1);
          intent.putExtra("aspectY", 1);
          intent.putExtra("scale", true);
          intent.putExtra("return-data", true); 
          startActivityForResult(intent, 0);
          ...
      }
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      switch(requestCode) {
          case 0 : {    
          Bitmap bitmap = BitmapFactory.decodeFile(imageFilePath);
      }
      }
  }
  </code></pre>
  
  <p>If I use <code>intent.putExtra("crop", "true");</code>, <code>imageFilePath</code> returns null, if not it returns the correct file.</p>
  
  <p>Thanks for your help!</p>