Skip to content

Instantly share code, notes, and snippets.

@root-ansh
Created September 7, 2025 10:32
Show Gist options
  • Save root-ansh/1d8059aa0161d6550f18faa8f575dd6e to your computer and use it in GitHub Desktop.
Save root-ansh/1d8059aa0161d6550f18faa8f575dd6e to your computer and use it in GitHub Desktop.
private val getFileFromSystem: ActivityResultLauncher<Intent> = registerForActivityResult(StartActivityForResult()) { result ->
if (result.resultCode == RESULT_OK) {
val uri = result.data?.data
lifecycleScope.launch {
val file = uri?.toLocalFile(this@XMLActivity) // convert to local file
updateUi()// handle local file
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment