androidx.navigation
Interfaces
FloatingWindow |
A marker interface for |
Cmn
|
NavArgs |
An interface marking generated Args classes. |
android
|
NavController.OnDestinationChangedListener |
OnDestinationChangedListener receives a callback when the |
Cmn
android
|
NavDirections |
An interface that describes a navigation operation: action's id and arguments |
android
|
NavHost |
A host is a single context or container for navigation via a |
Cmn
|
Navigator.Extras |
Interface indicating that this class should be passed to its respective |
Cmn
|
SupportingPane |
A marker interface for |
Cmn
|
Classes
ActionOnlyNavDirections |
An implementation of |
android
|
ActivityNavigator |
ActivityNavigator implements cross-activity navigation. |
android
|
ActivityNavigator.Destination |
NavDestination for activity navigation |
android
|
ActivityNavigator.Extras |
Extras that can be passed to ActivityNavigator to customize what |
android
|
ActivityNavigator.Extras.Builder |
Builder for constructing new |
android
|
ActivityNavigatorDestinationBuilder |
DSL for constructing a new |
android
|
AnimBuilder |
DSL for setting custom Animation or Animator resources on a |
android
|
CollectionNavType |
A |
Cmn
|
NamedNavArgument |
Construct a named |
Cmn
|
NavAction |
Navigation actions provide a level of indirection between your navigation code and the underlying destinations. |
android
|
NavActionBuilder |
DSL for building a |
android
|
NavArgsLazy |
An implementation of |
android
|
NavArgument |
NavArgument denotes an argument that is supported by a |
Cmn
|
NavArgument.Builder |
A builder for constructing |
Cmn
|
NavArgumentBuilder |
DSL for constructing a new |
Cmn
|
NavBackStackEntry |
Representation of an entry in the back stack of a |
Cmn
android
|
NavController |
NavController manages app navigation within a |
Cmn
android
|
NavDeepLink |
NavDeepLink encapsulates the parsing and matching of a navigation deep link. |
Cmn
|
NavDeepLink.Builder |
A builder for constructing |
Cmn
|
NavDeepLinkBuilder |
Class used to construct deep links to a particular destination in a |
android
|
NavDeepLinkDslBuilder |
DSL for constructing a new |
Cmn
|
NavDeepLinkRequest |
A request for a deep link in a |
Cmn
|
NavDeepLinkRequest.Builder |
A builder for constructing |
Cmn
|
NavDestination |
NavDestination represents one node within an overall navigation graph. |
Cmn
android
|
NavDestinationBuilder |
DSL for constructing a new |
Cmn
android
|
NavGraph |
NavGraph is a collection of |
Cmn
android
|
NavGraphBuilder |
DSL for constructing a new |
Cmn
android
|
NavGraphNavigator |
A Navigator built specifically for |
Cmn
|
NavHostController |
Subclass of |
Cmn
android
|
NavInflater |
Class which translates a navigation XML file into a |
android
|
NavOptions |
NavOptions stores special options for navigate actions |
Cmn
android
|
NavOptions.Builder |
Builder for constructing new instances of NavOptions. |
Cmn
android
|
NavOptionsBuilder |
DSL for constructing a new |
Cmn
android
|
NavType |
NavType denotes the type that can be used in a |
Cmn
android
|
NavType.EnumType |
EnumType is used for |
android
|
NavType.ParcelableArrayType |
ParcelableArrayType is used for |
android
|
NavType.ParcelableType |
ParcelableType is used for passing Parcelables in |
android
|
NavType.SerializableArrayType |
SerializableArrayType is used for |
android
|
NavType.SerializableType |
SerializableType is used for Serializable |
android
|
NavUri |
Cmn
android
|
|
Navigator |
Navigator defines a mechanism for navigating within an app. |
Cmn
|
NavigatorProvider |
A NavigationProvider stores a set of |
Cmn
android
|
NavigatorState |
The NavigatorState encapsulates the state shared between the |
Cmn
|
PopUpToBuilder |
DSL for customizing |
Cmn
|
Objects
Navigation |
Entry point for navigation operations. |
Cmn
android
|
Annotations
NavDeepLinkDsl |
Cmn
|
|
NavDeepLinkSaveStateControl |
Cmn
|
|
NavDestination.ClassType |
This optional annotation allows tooling to offer auto-complete for the |
Cmn
android
|
NavDestinationDsl |
Cmn
|
|
NavOptionsDsl |
Cmn
|
|
Navigator.Name |
This annotation should be added to each Navigator subclass in Android to denote the default name used to register the Navigator with a |
Cmn
|
Type aliases
NavUri |
android
|
Top-level functions summary
ActivityNavigator.Extras |
ActivityNavigatorExtras(Create a new |
android
|
NavUri |
Creates a NavUri which parses the given encoded URI string. |
Cmn
|
NamedNavArgument |
navArgument(name: String, builder: NavArgumentBuilder.() -> Unit)Construct a new |
Cmn
|
NavDeepLink |
navDeepLink(deepLinkBuilder: NavDeepLinkDslBuilder.() -> Unit)Construct a new |
Cmn
|
inline NavDeepLink |
<T : Any> navDeepLink(Construct a new |
Cmn
|
NavDeepLink |
<T : Any> navDeepLink(Construct a new |
Cmn
|
NavOptions |
navOptions(optionsBuilder: NavOptionsBuilder.() -> Unit)Construct a new |
Cmn
|
Extension functions summary
inline Unit |
NavGraphBuilder.This function is deprecated. Use routes to build your ActivityDestination instead |
android
|
inline Unit |
NavGraphBuilder.activity(route: String, builder: ActivityNavigatorDestinationBuilder.() -> Unit)Construct a new |
android
|
inline Unit |
<T : Any> NavGraphBuilder.activity(Construct a new |
android
|
operator Boolean |
Returns |
android
|
inline operator Boolean |
Returns |
Cmn
|
operator Boolean |
Returns |
Cmn
|
operator Boolean |
Returns |
Cmn
|
inline NavGraph |
NavController.This function is deprecated. Use routes to create your NavGraph instead |
android
|
inline NavGraph |
NavHost.This function is deprecated. Use routes to create your NavGraph instead |
android
|
inline NavGraph |
NavController.createGraph(Construct a new |
Cmn
|
inline NavGraph |
NavHost.createGraph(Construct a new |
Cmn
|
inline NavGraph |
NavController.createGraph(Construct a new |
Cmn
|
inline NavGraph |
NavHost.createGraph(Construct a new |
Cmn
|
inline NavGraph |
NavController.createGraph(Construct a new |
Cmn
|
inline NavGraph |
NavHost.createGraph(Construct a new |
Cmn
|
NavController |
Find a |
android
|
NavController |
Activity.findNavController(viewId: @IdRes Int)Find a |
android
|
inline operator T |
<T : Navigator<NavDestination>> NavigatorProvider.get(clazz: KClass<T>)Retrieves a registered |
Cmn
android
|
inline operator NavDestination |
Returns the destination with |
android
|
inline operator T |
<T : Navigator<NavDestination>> NavigatorProvider.get(name: String)Retrieves a registered |
Cmn
|
inline operator NavDestination |
Returns the destination with |
Cmn
|
inline operator NavDestination |
Returns the destination with |
Cmn
|
inline operator NavDestination |
Returns the destination with |
Cmn
|
inline operator Unit |
NavGraph.minusAssign(node: NavDestination)Removes |
Cmn
|
inline NavArgsLazy<Args> |
@MainThreadReturns a |
android
|
inline Lazy<VM> |
@MainThreadReturns a property delegate to access a |
android
|
inline Lazy<VM> |
@MainThreadReturns a property delegate to access a |
android
|
inline NavGraph |
NavigatorProvider.This function is deprecated. Use routes to build your NavGraph instead |
android
|
inline Unit |
NavGraphBuilder.This function is deprecated. Use routes to build your nested NavGraph instead |
android
|
inline Unit |
<T : Any> NavGraphBuilder.navigation(Construct a nested |
Cmn
|
inline Unit |
<T : Any> NavGraphBuilder.navigation(Construct a nested |
Cmn
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
Cmn
|
inline Unit |
NavGraphBuilder.navigation(Construct a nested |
Cmn
|
Unit |
<T : Any> NavGraphBuilder.navigation(Construct a nested |
Cmn
|
Unit |
<T : Any> NavGraphBuilder.navigation(Construct a nested |
Cmn
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
Cmn
|
inline NavGraph |
NavigatorProvider.navigation(Construct a new |
Cmn
|
inline operator Unit |
NavigatorProvider.plusAssign(navigator: Navigator<NavDestination>)Register a navigator using the name provided by the |
Cmn
|
inline operator Unit |
NavGraph.plusAssign(node: NavDestination)Adds a destination to this NavGraph. |
Cmn
|
inline operator Unit |
NavGraph.plusAssign(other: NavGraph)Add all destinations from another collection to this one. |
Cmn
|
inline operator Navigator<NavDestination>? |
NavigatorProvider.set(Register a |
Cmn
|
inline T |
<T : Any?> NavBackStackEntry.toRoute()Returns route as an object of type |
Cmn
|
T |
<T : Any?> NavBackStackEntry.toRoute(route: KClass<*>)Returns route as an object of type |
Cmn
|
inline T |
Returns route as an object of type |
Cmn
|
T |
Returns route as an object of type |
Cmn
|
Top-level functions
ActivityNavigatorExtras
fun ActivityNavigatorExtras(
activityOptions: ActivityOptionsCompat? = null,
flags: Int = 0
): ActivityNavigator.Extras
Create a new ActivityNavigator.Extras instance with a specific ActivityOptionsCompat instance and/or any Intent.FLAG_ACTIVITY_ flags.
| Parameters | |
|---|---|
activityOptions: ActivityOptionsCompat? = null |
Optional |
flags: Int = 0 |
|
NavUri
fun NavUri(uriString: String): NavUri
Creates a NavUri which parses the given encoded URI string.
| Parameters | |
|---|---|
uriString: String |
an RFC 2396-compliant, encoded URI |
| Returns | |
|---|---|
NavUri |
NavUri for this given uri string |
navArgument
fun navArgument(name: String, builder: NavArgumentBuilder.() -> Unit): NamedNavArgument
Construct a new NavArgument
navDeepLink
fun navDeepLink(deepLinkBuilder: NavDeepLinkDslBuilder.() -> Unit): NavDeepLink
Construct a new NavDeepLink
| Parameters | |
|---|---|
deepLinkBuilder: NavDeepLinkDslBuilder.() -> Unit |
the builder used to construct the deeplink |
navDeepLink
inline fun <T : Any> navDeepLink(
basePath: String,
typeMap: Map<KType, NavType<*>> = emptyMap(),
noinline deepLinkBuilder: NavDeepLinkDslBuilder.() -> Unit = {}
): NavDeepLink
Construct a new NavDeepLink
Extracts deeplink arguments from T and appends it to the basePath. The base path & generated arguments form the final uri pattern for the deeplink.
See docs on the safe args version of NavDeepLink.Builder.setUriPattern for the final uriPattern's generation logic.
| Parameters | |
|---|---|
<T : Any> |
The deepLink KClass to extract arguments from |
basePath: String |
The base uri path to append arguments onto |
typeMap: Map<KType, NavType<*>> = emptyMap() |
map of destination arguments' kotlin type |
noinline deepLinkBuilder: NavDeepLinkDslBuilder.() -> Unit = {} |
the builder used to construct the deeplink |
navDeepLink
fun <T : Any> navDeepLink(
route: KClass<T>,
basePath: String,
typeMap: Map<KType, NavType<*>> = emptyMap(),
deepLinkBuilder: NavDeepLinkDslBuilder.() -> Unit
): NavDeepLink
Construct a new NavDeepLink
Extracts deeplink arguments from T and appends it to the basePath. The base path & generated arguments form the final uri pattern for the deeplink.
See docs on the safe args version of NavDeepLink.Builder.setUriPattern for the final uriPattern's generation logic.
| Parameters | |
|---|---|
route: KClass<T> |
The deepLink |
basePath: String |
The base uri path to append arguments onto |
typeMap: Map<KType, NavType<*>> = emptyMap() |
map of destination arguments' kotlin type |
deepLinkBuilder: NavDeepLinkDslBuilder.() -> Unit |
the builder used to construct the deeplink |
navOptions
fun navOptions(optionsBuilder: NavOptionsBuilder.() -> Unit): NavOptions
Construct a new NavOptions
Extension functions
activity
inline fun NavGraphBuilder.activity(id: @IdRes Int, builder: ActivityNavigatorDestinationBuilder.() -> Unit): Unit
Construct a new ActivityNavigator.Destination
activity
inline fun NavGraphBuilder.activity(route: String, builder: ActivityNavigatorDestinationBuilder.() -> Unit): Unit
Construct a new ActivityNavigator.Destination
activity
inline fun <T : Any> NavGraphBuilder.activity(
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: ActivityNavigatorDestinationBuilder.() -> Unit
): Unit
Construct a new ActivityNavigator.Destination
| Parameters | |
|---|---|
<T : Any> |
destination's unique route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
map of destination arguments' kotlin type |
builder: ActivityNavigatorDestinationBuilder.() -> Unit |
the builder used to construct the fragment destination |
contains
operator fun NavGraph.contains(id: @IdRes Int): Boolean
Returns true if a destination with id is found in this navigation graph.
contains
inline operator fun <T : Any> NavGraph.contains(route: KClass<T>): Boolean
Returns true if a destination with route is found in this navigation graph.
contains
operator fun NavGraph.contains(route: String): Boolean
Returns true if a destination with route is found in this navigation graph.
contains
operator fun <T : Any> NavGraph.contains(route: T): Boolean
Returns true if a destination with route is found in this navigation graph.
createGraph
inline fun NavController.createGraph(
id: @IdRes Int = 0,
startDestination: @IdRes Int,
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
createGraph
inline fun NavHost.createGraph(
id: @IdRes Int = 0,
startDestination: @IdRes Int,
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
createGraph
inline fun NavController.createGraph(
startDestination: String,
route: String? = null,
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: String |
the route for the start destination |
route: String? = null |
the route for the graph |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
createGraph
inline fun NavHost.createGraph(
startDestination: String,
route: String? = null,
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
createGraph
inline fun NavController.createGraph(
startDestination: Any,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: Any |
the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added as a |
route: KClass<*>? = null |
the graph's unique route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
createGraph
inline fun NavHost.createGraph(
startDestination: Any,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: Any |
the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added as a |
route: KClass<*>? = null |
the graph's unique route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
createGraph
inline fun NavController.createGraph(
startDestination: KClass<*>,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: KClass<*> |
the starting destination's route from a |
route: KClass<*>? = null |
the graph's unique route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
createGraph
inline fun NavHost.createGraph(
startDestination: KClass<*>,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: KClass<*> |
the starting destination's route from a |
route: KClass<*>? = null |
the graph's unique route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
findNavController
fun View.findNavController(): NavController
Find a NavController associated with a View.
Calling this on a View not within a NavHost will result in an IllegalStateException
findNavController
fun Activity.findNavController(viewId: @IdRes Int): NavController
Find a NavController given the id of a View and its containing Activity.
Calling this on a View that is not a NavHost or within a NavHost will result in an IllegalStateException
get
inline operator fun <T : Navigator<NavDestination>> NavigatorProvider.get(clazz: KClass<T>): T
Retrieves a registered Navigator using the name provided by the Navigator.Name annotation.
| Throws | |
|---|---|
kotlin.IllegalStateException |
if the Navigator has not been added |
get
inline operator fun NavGraph.get(id: @IdRes Int): NavDestination
Returns the destination with id.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if no destination is found with that id. |
get
inline operator fun <T : Navigator<NavDestination>> NavigatorProvider.get(name: String): T
Retrieves a registered Navigator by name.
| Throws | |
|---|---|
kotlin.IllegalStateException |
if the Navigator has not been added |
get
inline operator fun <T : Any> NavGraph.get(route: KClass<T>): NavDestination
Returns the destination with route from KClass.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if no destination is found with that route. |
get
inline operator fun NavGraph.get(route: String): NavDestination
Returns the destination with route.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if no destination is found with that route. |
get
inline operator fun <T : Any> NavGraph.get(route: T): NavDestination
Returns the destination with route from an Object.
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if no destination is found with that route. |
minusAssign
inline operator fun NavGraph.minusAssign(node: NavDestination): Unit
Removes node from this navigation graph.
navArgs
@MainThread
inline fun <Args : NavArgs> Activity.navArgs(): NavArgsLazy<Args>
Returns a Lazy delegate to access the Activity's extras as an Args instance.
It is strongly recommended that this method only be used when the Activity is started by androidx.navigation.NavController.navigate with the corresponding androidx.navigation.NavDirections object, which ensures that the required arguments are present.
class MyActivity : Activity() {
val args: MyActivityArgs by navArgs()
}
This property can be accessed only after the Activity is attached to the Application, and access prior to that will result in IllegalStateException.
navGraphViewModels
@MainThread
inline fun <VM : ViewModel> Fragment.navGraphViewModels(
navGraphId: @IdRes Int,
noinline extrasProducer: (() -> CreationExtras)? = null,
noinline factoryProducer: (() -> ViewModelProvider.Factory)? = null
): Lazy<VM>
Returns a property delegate to access a ViewModel scoped to a navigation graph present on the NavController back stack:
class MyFragment : Fragment() {
val viewmodel: MainViewModel by navGraphViewModels(R.id.main)
}
Custom ViewModelProvider.Factory can be defined via factoryProducer parameter, factory returned by it will be used to create ViewModel:
class MyFragment : Fragment() {
val viewmodel: MainViewModel by navGraphViewModels(R.id.main) { myFactory }
}
This property can be accessed only after this NavGraph is on the NavController back stack, and an attempt access prior to that will result in an IllegalArgumentException.
| Parameters | |
|---|---|
navGraphId: @IdRes Int |
ID of a NavGraph that exists on the |
noinline extrasProducer: (() -> CreationExtras)? = null |
lambda that will be called during initialization to return |
noinline factoryProducer: (() -> ViewModelProvider.Factory)? = null |
lambda that will be called during initialization to return |
navGraphViewModels
@MainThread
inline fun <VM : ViewModel> Fragment.navGraphViewModels(
navGraphRoute: String,
noinline extrasProducer: (() -> CreationExtras)? = null,
noinline factoryProducer: (() -> ViewModelProvider.Factory)? = null
): Lazy<VM>
Returns a property delegate to access a ViewModel scoped to a navigation graph present on the NavController back stack:
class MyFragment : Fragment() {
val viewModel: MainViewModel by navGraphViewModels("main")
}
Custom ViewModelProvider.Factory can be defined via factoryProducer parameter, factory returned by it will be used to create ViewModel:
class MyFragment : Fragment() {
val viewModel: MainViewModel by navGraphViewModels("main") { myFactory }
}
This property can be accessed only after this NavGraph is on the NavController back stack, and an attempt access prior to that will result in an IllegalArgumentException.
| Parameters | |
|---|---|
navGraphRoute: String |
|
noinline extrasProducer: (() -> CreationExtras)? = null |
lambda that will be called during initialization to return |
noinline factoryProducer: (() -> ViewModelProvider.Factory)? = null |
lambda that will be called during initialization to return |
navigation
inline fun NavigatorProvider.navigation(
id: @IdRes Int = 0,
startDestination: @IdRes Int,
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
id: @IdRes Int = 0 |
the destination's unique id |
startDestination: @IdRes Int |
the starting destination for this NavGraph |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
NavGraph |
the newly constructed NavGraph |
navigation
inline fun NavGraphBuilder.navigation(
id: @IdRes Int,
startDestination: @IdRes Int,
builder: NavGraphBuilder.() -> Unit
): Unit
Construct a nested NavGraph
| Parameters | |
|---|---|
id: @IdRes Int |
the destination's unique id |
startDestination: @IdRes Int |
the starting destination for this NavGraph |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
Unit |
the newly constructed nested NavGraph |
navigation
inline fun <T : Any> NavGraphBuilder.navigation(
startDestination: Any,
typeMap: Map<KType, NavType<*>> = emptyMap(),
noinline builder: NavGraphBuilder.() -> Unit
): Unit
Construct a nested NavGraph
| Parameters | |
|---|---|
<T : Any> |
the graph's unique route from a KClass |
startDestination: Any |
the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added with route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
noinline builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
Unit |
the newly constructed nested NavGraph |
navigation
inline fun <T : Any> NavGraphBuilder.navigation(
startDestination: KClass<*>,
typeMap: Map<KType, NavType<*>> = emptyMap(),
noinline builder: NavGraphBuilder.() -> Unit
): Unit
Construct a nested NavGraph
| Parameters | |
|---|---|
<T : Any> |
the graph's unique route from a KClass |
startDestination: KClass<*> |
the starting destination's route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
noinline builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
Unit |
the newly constructed nested NavGraph |
navigation
inline fun NavigatorProvider.navigation(
startDestination: String,
route: String? = null,
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: String |
the starting destination's route for this NavGraph |
route: String? = null |
the destination's unique route |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
NavGraph |
the newly constructed NavGraph |
navigation
inline fun NavGraphBuilder.navigation(
startDestination: String,
route: String,
builder: NavGraphBuilder.() -> Unit
): Unit
Construct a nested NavGraph
| Parameters | |
|---|---|
startDestination: String |
the starting destination's route for this NavGraph |
route: String |
the destination's unique route |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
Unit |
the newly constructed nested NavGraph |
navigation
fun <T : Any> NavGraphBuilder.navigation(
route: KClass<T>,
startDestination: Any,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): Unit
Construct a nested NavGraph
| Parameters | |
|---|---|
route: KClass<T> |
the graph's unique route from a KClass |
startDestination: Any |
the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added with route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
Unit |
the newly constructed nested NavGraph |
navigation
fun <T : Any> NavGraphBuilder.navigation(
route: KClass<T>,
startDestination: KClass<*>,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): Unit
Construct a nested NavGraph
| Parameters | |
|---|---|
route: KClass<T> |
the graph's unique route from KClass |
startDestination: KClass<*> |
the starting destination's route from a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
Unit |
the newly constructed nested NavGraph |
navigation
inline fun NavigatorProvider.navigation(
startDestination: Any,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: Any |
the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added with route from a |
route: KClass<*>? = null |
the graph's unique route as a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
NavGraph |
the newly constructed NavGraph |
navigation
inline fun NavigatorProvider.navigation(
startDestination: KClass<*>,
route: KClass<*>? = null,
typeMap: Map<KType, NavType<*>> = emptyMap(),
builder: NavGraphBuilder.() -> Unit
): NavGraph
Construct a new NavGraph
| Parameters | |
|---|---|
startDestination: KClass<*> |
the starting destination's route from a |
route: KClass<*>? = null |
the graph's unique route as a |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in the |
builder: NavGraphBuilder.() -> Unit |
the builder used to construct the graph |
| Returns | |
|---|---|
NavGraph |
the newly constructed NavGraph |
plusAssign
inline operator fun NavigatorProvider.plusAssign(navigator: Navigator<NavDestination>): Unit
Register a navigator using the name provided by the Navigator.Name annotation.
plusAssign
inline operator fun NavGraph.plusAssign(node: NavDestination): Unit
Adds a destination to this NavGraph. The destination must have an id set.
The destination must not have a parent set. If the destination is already part of a NavGraph, call NavGraph.remove before calling this method.
| Parameters | |
|---|---|
node: NavDestination |
destination to add |
plusAssign
inline operator fun NavGraph.plusAssign(other: NavGraph): Unit
Add all destinations from another collection to this one. As each destination has at most one parent, the destinations will be removed from the given NavGraph.
| Parameters | |
|---|---|
other: NavGraph |
collection of destinations to add. All destinations will be removed from the parameter graph after being added to this graph. |
set
inline operator fun NavigatorProvider.set(
name: String,
navigator: Navigator<NavDestination>
): Navigator<NavDestination>?
Register a Navigator by name. If a navigator by this name is already registered, this new navigator will replace it.
| Returns | |
|---|---|
Navigator<NavDestination>? |
the previously added |
toRoute
inline fun <T : Any?> NavBackStackEntry.toRoute(): T
Returns route as an object of type T
Extrapolates arguments from NavBackStackEntry.arguments and recreates object T
| Parameters | |
|---|---|
<T : Any?> |
the entry's |
| Returns | |
|---|---|
T |
A new instance of this entry's |
toRoute
fun <T : Any?> NavBackStackEntry.toRoute(route: KClass<*>): T
Returns route as an object of type T
Extrapolates arguments from NavBackStackEntry.arguments and recreates object T
| Parameters | |
|---|---|
route: KClass<*> |
the entry's |
| Returns | |
|---|---|
T |
A new instance of this entry's |
toRoute
inline fun <T : Any> SavedStateHandle.toRoute(
typeMap: Map<KType, NavType<*>> = emptyMap()
): T
Returns route as an object of type T
Extrapolates arguments from SavedStateHandle and recreates object T
| Parameters | |
|---|---|
<T : Any> |
the entry's |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in |
| Returns | |
|---|---|
T |
A new instance of this entry's |
toRoute
fun <T : Any> SavedStateHandle.toRoute(
route: KClass<T>,
typeMap: Map<KType, NavType<*>> = emptyMap()
): T
Returns route as an object of type T
Extrapolates arguments from SavedStateHandle and recreates object T
| Parameters | |
|---|---|
route: KClass<T> |
the entry's |
typeMap: Map<KType, NavType<*>> = emptyMap() |
A mapping of KType to custom NavType<*> in |
| Returns | |
|---|---|
T |
A new instance of this entry's |