In your onActivityResult()
you can use such way:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK) {
val documentFile: DocumentFile = DocumentFile.fromSingleUri(this, data!!.data!!)!!
val string = data.data?.let { uri -> contentResolver.openInputStream(uri).use { it!!.readBytes() } }
//Base64.encodeToString(string, Base64.NO_WRAP)
}
}
here:
Base64.encodeToString(string, Base64.NO_WRAP)
you can get your file encoded to Base64 string and process it. I hope that it will help you :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…