I'm using Kotlin, and in converting the file uri to a file, the file uri value starts with content://, so I can't access it. So you need to know the absolute path.
There are many java codes, but the code for kotlin does not exist, so I tried to convert it, but an error occurs in kotlin. Please help me
Not only Image file I want all type files Thanks a lot
There is a separate mechanism for getting path from URI in the versions below Kitkat (
getDataColumn(...)method will serve the purpose as gets the file path usingContentResolver).In the versions above the Kitkat, we have to implement a separate logic for different file types, either they are picked from documents directory, Gallery, or downloads folder.
URIPathHelper.kt
You can later use it like