title: Taking picture with camera intent rotate picture in portrait mode android
body: <p>Picture was taken successfully with camera but in portrait mode  on samsung galaxy s3 the picture gets rotated.  How can i solve this issue.
  Camera intent is as follows: </p>
  
  <pre><code>Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
          intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(xdestination));
          startActivityForResult(intent, CAMERA_PIC_REQUEST);
  </code></pre>
  
  <p>In activity for result </p>
  
  <pre><code> if (requestCode==CAMERA_PIC_REQUEST){
  
              //  Bitmap bm = (Bitmap) data.getExtras().get("data"); 
  
                  Uri photo_uri = Uri.fromFile(xdestination);
  
                  Editer.PHOTO_FROM=11;
  
                  Bitmap decodeSampledBitmapFromFile=null;
                  try {
                      decodeSampledBitmapFromFile = decodeUri(photo_uri);
                  } catch (FileNotFoundException e1) {
                      // TODO Auto-generated catch block
                      e1.printStackTrace();
                  }
  
                  ByteArrayOutputStream bytes = new ByteArrayOutputStream();
                  decodeSampledBitmapFromFile.compress(Bitmap.CompressFormat.JPEG,100, bytes);
  
                  File f  = new File(Environment.getExternalStorageDirectory(), "user_image.jpg");
  
                  try {
  
                      if(f.exists())
                          f.delete();
  
                      f.createNewFile();
  
                      FileOutputStream fo = new FileOutputStream(f);
                      fo.write(bytes.toByteArray());
                      fo.close();
  
                  } catch (IOException e) {
  
                      e.printStackTrace( );
                      Log.d("ERROR", e.toString());
                  }
  
              }
  </code></pre>