0

I have a code that captures an image from a user's gallery and inserts it into an ImageView, however, the image always rotates somewhere, sometimes even inverted, like the second photo above on the printScreen, why does this happen?

Image example:

rotate

And follow the code for the function to capture the image:

Uri pickedImage = data.getData(); //Puxamos a foto que o usuario selecionou para uma variavel
            Log.i("image antes", pickedImage.toString());
            try {
                bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), pickedImage);
                uriSelecionada = getImageUri(getApplicationContext(), bitmap, "anun1Img");
                Log.i("image dps", uriSelecionada.toString());
            } catch (Exception e) {
                Log.i("image n dps", pickedImage.toString());
                e.printStackTrace();
            }
            imgAnun1.setVisibility(View.VISIBLE);
            Glide.with(this).asBitmap().load(bitmap).into(imgAnun1);

.xml ImageView

<ImageView
                android:id="@+id/anuncioImg1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="fitXY"
                android:visibility="gone"/>
luke cross
  • 321
  • 1
  • 2
  • 19

0 Answers0