Register now for Android Dev Summit 2019!

NavHost

interface NavHost
androidx.navigation.NavHost

A host is a single context or container for navigation via a NavController.

It is strongly recommended to construct the nav controller by instantiating a NavHostController, which offers additional APIs specifically for a NavHost. The NavHostController should still only be externally accessible as a NavController, rather than directly exposing it as a NavHostController.

Navigation hosts must:

Optionally, a navigation host should consider calling:

Summary

Public methods

abstract NavController

Returns the navigation controller for this navigation host.

Extension functions

From androidx.navigation
NavGraph
NavHost.createGraph(@IdRes id: Int = 0, @IdRes startDestination: Int, builder: NavGraphBuilder.() -> Unit)

Construct a new NavGraph

Public methods

getNavController

@NonNull abstract fun getNavController(): NavController

Returns the navigation controller for this navigation host.

Return
NavController: this host's navigation controller