Skip to content

Instantly share code, notes, and snippets.

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 ashley-figueira/008c816cb051340f8b75ba0890285fb9 to your computer and use it in GitHub Desktop.
Save ashley-figueira/008c816cb051340f8b75ba0890285fb9 to your computer and use it in GitHub Desktop.
private fun launchNewsListFragment() {
launchFragmentInHiltContainer<NewsListFragment> {
navController.setGraph(R.navigation.main_nav_graph)
navController.setCurrentDestination(R.id.newsListFragment)
this.viewLifecycleOwnerLiveData.observeForever { viewLifecycleOwner ->
if (viewLifecycleOwner != null) {
// The fragment’s view has just been created
Navigation.setViewNavController(this.requireView(), navController)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment