Google is committed to advancing racial equity for Black communities. See how.

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

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

Construct a new androidx.navigation.NavGraph that supports dynamic navigation destinations

Public methods

getNavController

@NonNull abstract fun getNavController(): NavController

Returns the navigation controller for this navigation host.

Return
NavController this host's navigation controller