I'm trying to open a file picker in android, select a json file then get the text from it. The app crashes after i select the file because it can not find the path.
I have tried adding external storage read / write permission and changing the path format
/// some Activity code
val myFileIntent=Intent()
.setType("*/*")
.setAction(Intent.ACTION_GET_CONTENT)
startActivityForResult(myFileIntent,10)
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
val path = data!!.data.path
val jsonContent = File(path).readText()
}