NavController
open class NavController
kotlin.Any | |
↳ | androidx.navigation.NavController |
NavController manages app navigation within a NavHost
.
Apps will generally obtain a controller directly from a host, or by using one of the utility methods on the Navigation
class rather than create a controller directly.
Navigation flows and destinations are determined by the navigation graph
owned by the controller. These graphs are typically inflated
from an Android resource, but, like views, they can also be constructed or combined programmatically or for the case of dynamic navigation structure. (For example, if the navigation structure of the application is determined by live data obtained' from a remote server.)
Summary
Nested classes | |
---|---|
abstract |
OnDestinationChangedListener receives a callback when the |
Constants | |
---|---|
static String |
The |
Public constructors | |
---|---|
Constructs a new controller for a given |
Public methods | |
---|---|
open Unit |
Adds an |
open NavDeepLinkBuilder |
Create a deep link to a destination within this NavController. |
open NavBackStackEntry |
getBackStackEntry(@IdRes : Int) Gets the topmost |
open NavBackStackEntry? |
Gets the topmost |
open NavDestination? |
Gets the current destination. |
open NavGraph |
getGraph() Gets the topmost navigation graph associated with this NavController. |
open NavInflater |
Returns the |
open NavigatorProvider |
Retrieve the NavController's |
open NavBackStackEntry? |
Gets the previous visible |
open ViewModelStoreOwner |
getViewModelStoreOwner(@IdRes : Int) Gets the |
open Boolean |
handleDeepLink(@Nullable : Intent?) Checks the given Intent for a Navigation deep link and navigates to the deep link if present. |
open Unit |
Navigate to a destination from the current navigation graph. |
open Unit |
Navigate to a destination from the current navigation graph. |
open Unit |
navigate(@IdRes : Int, @Nullable : Bundle?, @Nullable : NavOptions?) Navigate to a destination from the current navigation graph. |
open Unit |
navigate(@IdRes : Int, @Nullable : Bundle?, @Nullable : NavOptions?, @Nullable : Navigator.Extras?) Navigate to a destination from the current navigation graph. |
open Unit |
Navigate to a destination via the given deep link |
open Unit |
navigate(@NonNull : Uri, @Nullable : NavOptions?) Navigate to a destination via the given deep link |
open Unit |
navigate(@NonNull : Uri, @Nullable : NavOptions?, @Nullable : Navigator.Extras?) Navigate to a destination via the given deep link |
open Unit |
navigate(@NonNull : NavDeepLinkRequest) Navigate to a destination via the given |
open Unit |
navigate(@NonNull : NavDeepLinkRequest, @Nullable : NavOptions?) Navigate to a destination via the given |
open Unit |
navigate(@NonNull : NavDeepLinkRequest, @Nullable : NavOptions?, @Nullable : Navigator.Extras?) Navigate to a destination via the given |
open Unit |
navigate(@NonNull : NavDirections) Navigate via the given |
open Unit |
navigate(@NonNull : NavDirections, @Nullable : NavOptions?) Navigate via the given |
open Unit |
navigate(@NonNull : NavDirections, @NonNull : Navigator.Extras) Navigate via the given |
open Boolean |
Attempts to navigate up in the navigation hierarchy. |
open Boolean |
Attempts to pop the controller's back stack. |
open Boolean |
popBackStack(@IdRes : Int, : Boolean) Attempts to pop the controller's back stack back to a specific destination. |
open Unit |
Removes an |
open Unit |
restoreState(@Nullable : Bundle?) Restores all navigation controller state from a bundle. |
open Bundle? |
Saves all navigation controller state to a Bundle. |
open Unit |
Sets the |
open Unit |
Sets the |
open Unit |
Sets the |
open Unit |
Sets the |
Extension functions | ||
---|---|---|
From androidx.navigation
|
||
From androidx.navigation.compose
|