Add at the corresponding location in the onActivityResult processing
val cursor = contentResolver.query(data? .data!!!!! , Array(1){MediaStore.Images.Media.DATA},null.null.null) cursor!! .moveToFirst()// The converted path
val photoPath = cursor.getString(0)
cursor.close()
Copy the code