title: Crop saving Bitmap
body: <p>I'm trying to capture a photo, then crop it. So basically, I start camera Intent, then I start crop intent.</p>
  
  <p>As I can't pass a big bitmap through "onActivityResult" data, I created a URI to save the image directly to SDCard, but for some reason, it's being saved on the emulator, but not on a real device. 
  (I mean, the CROP isn't saved on the real device. )</p>
  
  <p>This is the code:</p>
  
  <pre><code>File resultingFile;
  Bitmap fotoCreada;
  Uri uriFoto;
  </code></pre>
  
  <p>Camera Intent:</p>
  
  <pre><code>File folder = new File(Environment.getExternalStorageDirectory().toString()+"/PictureFolder/");
  folder.mkdirs();
  Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  resultingFile=new File(folder.toString() + "/"+currentDateandTime+".jpg");
  this.uriFoto=Uri.fromFile(resultingFile);
  cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, this.uriFoto);
  startActivityForResult(cameraIntent, 1888); 
  </code></pre>
  
  <p>Then I retrieve result:</p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent data) {
      //Si venim de la camera
      if( requestCode == 1888 &amp;&amp; resultCode == -1) { //-1 = TOT HA ANAT BE.
          Bitmap photo = BitmapFactory.decodeFile(resultingFile.getPath());
          Matrix matrix = new Matrix();
          matrix.postRotate(90);
          matrix.postScale(0.5f,0.5f);
          Bitmap photoRotated = Bitmap.createBitmap(photo, 0, 0, photo.getWidth(), photo.getHeight(), matrix, true);
          //Desem foto rotada.
          this.fotoCreada=photoRotated;
          try {
              FileOutputStream out = new FileOutputStream(this.resultingFile.getPath());
              this.fotoCreada.compress(Bitmap.CompressFormat.PNG, 90, out);
          } catch (Exception e) {
              e.printStackTrace();
          }
          performCrop();
      }
  </code></pre>
  
  <p>So I call performCrop();</p>
  
  <pre><code>private void performCrop() {
      try {
          Log.d("debugging","Estic a crop. La foto és:"+this.uriFoto);
          Intent cropIntent = new Intent("com.android.camera.action.CROP");
          cropIntent.setDataAndType(this.uriFoto, "image/*");
          cropIntent.putExtra("crop", "true");
          cropIntent.putExtra("aspectX", 1);
          cropIntent.putExtra("aspectY", 1);
          cropIntent.putExtra("outputX", 600);
          cropIntent.putExtra("outputY", 600);
          //cropIntent.putExtra("return-data", true);
          cropIntent.putExtra("ouput", this.uriFoto);
          startActivityForResult(cropIntent,1234);
      }
      catch(ActivityNotFoundException anfe){
          //display an error message
          String errorMessage = "Whoops - your device doesn't support the crop action!";
          Toast toast = Toast.makeText(this.cont, errorMessage, Toast.LENGTH_SHORT);
          toast.show();
      }
  }
  </code></pre>
  
  <p>As you can see:</p>
  
  <pre><code>cropIntent.putExtra("ouput", this.uriFoto);
  </code></pre>
  
  <p>Basically tells to Output the crop to that URI.
  The URI is correct, as I've debugged it (LogCat):</p>
  
  <blockquote>
    <p>Estic a crop. La foto és: file:///mnt/sdcard/PictureFolder/20130123_223058.jpg</p>
  </blockquote>
  
  <p>And then, I'm back to activity result:</p>
  
  <pre><code>[... previous onactivityresult]
  if (requestCode == 1234 &amp;&amp; resultCode == -1){
          Log.d("debugging","Ha acabat el croop.");
          Uri imageUri = this.uriFoto;
          try {
              Bitmap photo = MediaStore.Images.Media.getBitmap(this.cont.getContentResolver(), imageUri);
              this.fotoCreada=photo;
              ((ImageView) myFragmentView.findViewById(R.id.fotoCapturada)).setImageBitmap(this.fotoCreada);
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
          //Bitmap photo = BitmapFactory.decodeFile(resultingFile.getPath());     
      }
  </code></pre>
  
  <p><strong>But what I end up with, is displaying (setImageBitmap(this.fotoCreada);) the captured image from camera, but not the cropped picture. This happens on real device, but not on Emulator!</strong></p>
  
  <p>I tried to explain the best way I could. Feel free to ask.</p>
  
  <p>Thanks.</p>