Skip to content

Instantly share code, notes, and snippets.

@alistairsykes
Created June 11, 2019 08:00
Show Gist options
  • Save alistairsykes/75af4bd19eddb0b91338cbc537666fee to your computer and use it in GitHub Desktop.
Save alistairsykes/75af4bd19eddb0b91338cbc537666fee to your computer and use it in GitHub Desktop.
internal fun Activity.navigateUp() {
val successful = findNavController(R.id.id_to_host_fragment).popBackStack()
if (!successful) {
finish()
}
}
internal fun Fragment.navigateUp() {
requireActivity().navigateUp()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment