Skip to content

Instantly share code, notes, and snippets.

@vegeta2102
Created March 12, 2021 23:20
Show Gist options
  • Save vegeta2102/36b82948f0acccabf1470288e1140526 to your computer and use it in GitHub Desktop.
Save vegeta2102/36b82948f0acccabf1470288e1140526 to your computer and use it in GitHub Desktop.
@AndroidEntryPoint
class MediumFragment : Fragment(R.layout.fragment_medium) {
private val navigation: NavController by lazy {
findNavController()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
observeNavigationCallBack()
}
private fun observeNavigationCallBack() {
navigation.currentBackStackEntry?.savedStateHandle?.getLiveData<Boolean>("key")
?.observe(viewLifecycleOwner) {
Log.d(TAG, it.toString())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment