title: Motorola Android 2.2 camera ignore EXTRA_OUTPUT parameter
body: <p>I programatically open camera to take a video. I tell camera to put the video file to a specified place using code like below:</p>
  
  <pre><code>Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
  File out = new File("/sdcard/camera.mp4");
  Uri uri = Uri.fromFile(out);
  intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
  startActivityForResult(intent, GlobalUtility.CAMERA_VIDEO);
  </code></pre>
  
  <p>It works well on a HTC phone. But on my moto defy, it just ignore the MediaStore.EXTRA_OUTPUT parameter, and put the video to the default place.
  So then I use this code in onActivityResult() function to solve the problem:</p>
  
  <pre><code>private String getRealPathFromURI(Uri contentUri) {
      String[] proj = { MediaStore.Images.Media.DATA };
      Cursor cursor = managedQuery(contentUri, proj, null, null, null);
      int column_index = cursor
              .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
      cursor.moveToFirst();
      return cursor.getString(column_index);
  }
  
  String realPath;
  try {
      File file = new File("/sdcard/camera.mp4");
      if (!file.exists()) {
          Uri videoUri = data.getData();
          realPath = getRealPathFromURI(videoUri);
      }
  } catch (Exception ex) {
      Uri videoUri = data.getData();
      realPath = getRealPathFromURI(videoUri);
  }
  </code></pre>
  
  <p>Hope this will help some others.</p>