Код: Выделить всё
/document/msf:
Код: Выделить всё
Код: Выделить всё
private val xfile = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
var xmlFile = FileWrapperFactory(requireContext()).getAssetFileWrapper("file")
var xmlPath = ""
if (result.resultCode == Activity.RESULT_OK) {
xmlPath = result.data?.data?.path.toString()
xmlFile = FileWrapperFactory(requireContext()).getExternalFileWrapper(xmlPath)
}
viewBinding.pathName.setText(xmlPath)
}
....
fun getFile() {
val intent = Intent(Intent.ACTION_GET_CONTENT)
.addCategory(Intent.CATEGORY_OPENABLE)
.setType("*/*")
xfile.launch(Intent.createChooser(intent, "file"))
}
Подробнее здесь: https://stackoverflow.com/questions/783 ... ing-intent