Skip to content

Instantly share code, notes, and snippets.

@k0siara
Created November 5, 2022 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k0siara/253123d26405f3506041bfe4442c3699 to your computer and use it in GitHub Desktop.
Save k0siara/253123d26405f3506041bfe4442c3699 to your computer and use it in GitHub Desktop.
HomeFragment.kt
class HomeFragment : Fragment(R.layout.home_fragment) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
findNavController()
.currentBackStackEntry
?.savedStateHandle
?.getLiveData<String>("my-result-key")
?.observe(viewLifecycleOwner) { result ->
// Do something with the result.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment