Trying to create File from URI fails Kotlin

247 Views Asked by At

I am trying to create a File using the URI from ActivityResultContracts like this:

val galleryLauncher = rememberLauncherForActivityResult(ActivityResultContracts.GetContent()) { uri ->

            val myFile = uri?.toFile()

The file is a jpeg image. I have got this error: Uri lacks 'file' scheme: content://com.android.providers.media.documents/document/image%3A1000000001

0

There are 0 best solutions below