title: Camera API - Portrait image is saved as landscape
body: <p>I have tried to save and populate an image from the camera intent and populate the image into the ImageView. I tried to take a landscape picture and it worked well. The image is populated in the ImageView in landscape. However the problem arise when I tried to take a picture in portrait in the camera intent. The image preview before saving was still in portrait but when the results was returned to my ImageView, the image is in landscape.</p>
  
  <p>Below is the code i used.</p>
  
  <pre><code>private ContentValues values;
      private Uri imageUri;
      private final int PICTURE_RESULT = 1;
      private Bitmap thumbnail;
      private String imageurl;
  btn_takeImage.setOnClickListener(new OnClickListener()
          {
              @Override
              public void onClick(View v)
              {
  //              Intent camera_intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  //              startActivityForResult(camera_intent, CAMERA_PIC_REQUEST);
  
                  values = new ContentValues();
                  values.put(MediaStore.Images.Media.TITLE, "New Picture");
                  values.put(MediaStore.Images.Media.DESCRIPTION, "From your Camera");
                  imageUri = getContentResolver().insert(
                          MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
                  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                  intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
                  startActivityForResult(intent, PICTURE_RESULT);
              }
          });
  @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          switch (requestCode) {
  
          case PICTURE_RESULT:
              if (requestCode == PICTURE_RESULT)
                  if (resultCode == Activity.RESULT_OK) {
                      try {
                          thumbnail = MediaStore.Images.Media.getBitmap(
                                  getContentResolver(), imageUri);
                          img_backgroundImage.setImageBitmap(thumbnail);
                          imageurl = getRealPathFromURI(imageUri);    
                      } catch (Exception e) {
                          e.printStackTrace();
                      }
  
                  }
          }
      }
  </code></pre>