NavHostController
open class NavHostController : NavController
kotlin.Any | ||
↳ | androidx.navigation.NavController | |
↳ | androidx.navigation.NavHostController |
Subclass of NavController
that offers additional APIs for use by a NavHost
to connect the NavController to external dependencies.
Apps should generally not construct controllers, instead obtain a relevant controller directly from a navigation host via NavHost#getNavController()
or by using one of the utility methods on the Navigation
class.
Summary
Inherited constants | |
---|---|
Public constructors | |
---|---|
Construct a new controller for a given |
Public methods | |
---|---|
Unit |
Set whether the NavController should handle the system Back button events via the registered |
Unit |
setLifecycleOwner(@NonNull : LifecycleOwner) Sets the host's |
Unit |
setOnBackPressedDispatcher(@NonNull : OnBackPressedDispatcher) Sets the host's |
Unit |
setViewModelStore(@NonNull : ViewModelStore) Sets the host's ViewModelStore used by the NavController to store ViewModels at the navigation graph level. |
Inherited functions | |
---|---|