-1

I set an image I took with my phone's camera into an imageView but it changes its orientation to 90 degrees. If I check the image in my phone it is just in portrait mode and if I put it in the Imageview it changes to landscape mode.

Code where I set the image on my ImageView:

Bitmap bitmap = BitmapFactory.decodeFile(imgPath);

        Bitmap bt=Bitmap.createScaledBitmap(bitmap, 500, 800, false);

        imgView.setImageBitmap(bt);
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Jochem
  • 75
  • 3
  • 10
  • Please look here https://stackoverflow.com/questions/14066038/why-does-an-image-captured-using-camera-intent-gets-rotated-on-some-devices-on-a – Vadym Jan 22 '18 at 18:44
  • maybe your imageView has a tag in it or in its parent called "android:rotation="90" " .. please share the xml of that imageView of yours – Rizwan Atta Jan 22 '18 at 18:44
  • Do some research before asking questions – Rino Jan 23 '18 at 10:44

1 Answers1

2

You can properly handle bitmap orientation with ExifInterface. Please refer to this Android Developer Blog post.

Daniel Krzyczkowski
  • 2,732
  • 2
  • 20
  • 30