title: Auto Image Rotated from Portrait to Landscape
body: <p>I am taking photo and storing it into <code>SD Card</code> , and later viewing it from <code>SD Card</code> into <code>ImageView</code>, but getting as rotated ...</p>
  
  <p>I am capturing it in <code>Portrait mode</code> , but getting resultant image in <code>Landscape mode</code>...</p>
  
  <p>Is there something which I am missing ? </p>
  
  <p><a href="https://gist.github.com/9re/1990019" rel="nofollow">ExifUtil.java</a> class found here</p>
  
  <pre><code>/**
   * Displaying captured image/video on the screen
   * */
  private void previewMedia(boolean isImage) {
      // Checking whether captured media is image or video
      if (isImage) {
          imgPreview.setVisibility(View.VISIBLE);
  
          final Bitmap bitmap = BitmapFactory.decodeFile(filePath);
          Bitmap orientedBitmap = ExifUtil.rotateBitmap(filePath, bitmap);
  
          imgPreview.setImageBitmap(orientedBitmap);
      } else {
          imgPreview.setVisibility(View.GONE);
      }
  }
  </code></pre>
  
  <p>but still showing rotated image in a ImageView ...</p>