Custom NavController and custom NavHost

Viewed 738

I would like to use custom NavController where I manage access to different fragment for a logged user. According to documentation I should implement NavHost. I am not sure what is the correct way to implement custom NavController. Should NavHostFragment be extended and impelement NavHost interface?

1 Answers

A NavController (as it's designed at any rate) is really a part of the View layer and so subclassing should not be necessary or used for selecting where the user goes.

An alternative is to use views/view models to go to a different part of the nav graph based on a value (e.g., a LiveData) in the view model.

Related