T
T
Tsuzukeru2021-10-22 15:27:33
Android
Tsuzukeru, 2021-10-22 15:27:33

How to remove the camera rotation after the intent to the photo?

I create an intent for the camera as follows:

class GetPhotoContract : ActivityResultContract<Unit, Uri>() {
    private var imageUri: Uri? = null

    override fun createIntent(context: Context, input: Unit?): Intent {
        val values = ContentValues()
        values.put(MediaStore.Images.Media.TITLE, PICTURE_TITLE)
        values.put(MediaStore.Images.Media.DESCRIPTION, PICTURE_DESCRIPTION)
        imageUri = context.contentResolver.insert(
            MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
            values
        )
        val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri)
        return cameraIntent
    }

    override fun parseResult(resultCode: Int, intent: Intent?): Uri? {
        return when {
            resultCode != Activity.RESULT_OK -> null
            else -> imageUri
        }
    }
}


When you click on the button to take a picture - the result is rotated 90 degrees to the left. Why and how to remove it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question