I have a method to take a photo, take the sample of the vertical form just as I want, the horizontal lap and save the vertical photograph just as I wish for the exercise exercises, Activity called ViewerActivity and it is here Where the problem begins at the moment of displaying in an ImageView the photograph the horizontal sample: / he is reading and there is the class ExifInterface that allows to control the orientation of the image, but at the moment of displaying the Image is still horizontal
This class is in charge of sending the photo.
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == Activity.RESULT_OK) {
try {
ExifInterface exifInterface = new ExifInterface(photoFile.getAbsolutePath());
int valor = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (valor) {
case ExifInterface.ORIENTATION_ROTATE_90:
orientation = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
orientation = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
orientation = 270;
break;
}
} catch (Exception e) {
Log.d("mensaje", e.toString());
}
Intent i = new Intent(this, ViewerActivity.class);
i.putExtra(EXTRA_PHOTO_PATH, photoFile.getAbsolutePath());
i.putExtra(EXTRA_PHOTO_ORIENTATION, orientation);
i.putExtra(EXTRA_PHOTO_EDIT, false);
startActivityForResult(i, 10);
This ViewerActivity class displays the photo and then sends it
private void sendPicture() {
Intent intent = new Intent();
intent.putExtra("path", localPath);
intent.putExtra("orientation",orientation);
setResult(Activity.RESULT_OK, intent);
finish();
}