When you import an image from an Android gallery and display a bitmap,

Asked 2 years ago, Updated 2 years ago, 23 views

When you click the button, the gallery opens and when you select an image, the image is loaded into a bitmap It's displayed in the image view When I recall an image, the picture is loaded with a 90-degree rotation to the right.

Is there anything wrong with the sauce below? Thank you^

^
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if(resultCode == RESULT_OK)
        {
            if(requestCode == Define.GET_IMAGE)
            {
                Log.i("sinwhod","a = " + data.getData());
                tmpUri = data.getData();

                try
                {
                    originalBitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), data.getData());
                    Bitmap displayBitmp = MediaStore.Images.Media.getBitmap(getContentResolver(), data.getData());

                    imgvImage.setImageBitmap(resizeBitmap(displayBitmp,200));
                }
            }
        }
    }

android

2022-09-21 23:17

1 Answers

The framework concept is different for each device (or manufacturer), so there may be operational differences. See the link here for instructions on how to handle rotated images directly. Also, we recommend that you try the image loader such as Picasso and Glide.


2022-09-21 23:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.