I am working on an application that captures photos (using CropImage) and later wishes to resize them. My issue is that my code works on a phone running Android 10, but when I use an Android 13 device with the same unchanged code, I encounter a bug. I am unable to resize the photo after capturing it. Strangely, everything works perfectly when I select a photo from the gallery. After capturing a photo and attempting to confirm, I receive a permission error message, which I did not encounter on Android 10. I haven't tried it on another Android 13 device, but I am curious if anyone else has experienced the same problem.
II tried to identify the source of the issue and realized that the 'data' variable in OnActivityResult' is null, which is causing the problem.
`override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
val result = CropImage.getActivityResult(data)
if (resultCode == RESULT_OK) {
val resultUri = result.uri
bitmap = MediaStore.Images.Media.getBitmap(this.contentResolver, resultUri)
getTextFromImage(bitmap)
} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
val error = result.error
}
}
}`
this is the link of the github of Android Image Croper : https://github.com/ArthurHub/Android-Image-Cropper