When I call mPickFromGalleryLauncher.launch(PICK_FROM_GALLERY_INPUT)
gallery is opened. If in gallery I press back button application is closed.
How can I return to Fragment from gallery? Application use SingleActivity pattern with Android Navigation Component.
My Fragment:
class ImagesFragment : Fragment(R.layout.fragment_images) {
private val mPickFromGalleryLauncher by uiLazy {
registerForActivityResult(ActivityResultContracts.GetContent()) { uri ->
// handle uri
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
pickFromGalleryButton.setOnClickListener {
mPickFromGalleryLauncher.launch("image/*")
}
}
}