title: Set image orientation using ExifInterface
body: <p><code>setRotation method</code> in <code>Camera.Parameters</code> does not work in all devices. Somebody suggests to manually change the <code>EXIF</code> information to solve the problem. Can you give me a short example on how to set the <code>exif</code> information with <code>ExifInterface</code> in such a way to set the image orientation as portrait?</p>
  
  <pre><code>private int savePicture(byte[] data)
  {
         File pictureFile = getOutputMediaFile();
         if (pictureFile == null)
             return FILE_CREATION_ERROR;
  
         try {
             FileOutputStream fos = new FileOutputStream(pictureFile);
             fos.write(data);
             fos.close();
         } catch (FileNotFoundException e) {
             return FILE_NOT_FOUND;
         } catch (IOException e) {
             return ACCESSING_FILE_ERROR;
         }
  
     return OKAY;
  }
  </code></pre>
  
  <p>I've tried with this:</p>
  
  <pre><code>    try {
          ExifInterface exifi = new ExifInterface(pictureFile.getAbsolutePath());
          exifi.setAttribute(ExifInterface.TAG_ORIENTATION, String.valueOf(ExifInterface.ORIENTATION_ROTATE_90));
          exifi.saveAttributes();
      } catch (IOException e) {
          Log.e(TAG, "Exif error");
      }
  </code></pre>
  
  <p>but nothing change when I visualize the pictures from the android gallery.</p>