title: Camera orientation issue in Android
body: <p>I am building an application that uses camera to take pictures. Here is my source code to do this:</p>
  
  <pre><code>        File file = new File(Environment.getExternalStorageDirectory(),
              imageFileName);
      imageFilePath = file.getPath();
      Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
      //Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
      startActivityForResult(intent, ACTIVITY_NATIVE_CAMERA_AQUIRE);
  </code></pre>
  
  <p>On <code>onActivityResult()</code> method, I use <code>BitmapFactory.decodeStream()</code> to pickup the image.</p>
  
  <p>When I run my application on Nexus one, it runs well. But when I run on Samsung Galaxy S or HTC Inspire 4G, the image's direction is not correct.</p>
  
  <ul>
  <li>Capture with portrait mode, the real image (save on SD card) always rotates 90 degree. </li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/6MXUL.png" alt="image preview after shot"> <img src="https://i.stack.imgur.com/yiNdx.png" alt="real image on SD card"></p>
  
  <p>Image preview after shot --------- Real image on SD card</p>
  
  <ul>
  <li>Capture with landscape mode, all things are good.</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/pFvwi.png" alt="Image preview after shot"> <img src="https://i.stack.imgur.com/kZmx7.png" alt="Real image on SD card"> </p>
  
  <p>Image preview after shot --------- Real image on SD card </p>