NavDestination

public class NavDestination


NavDestination represents one node within an overall navigation graph.

Each destination is associated with a Navigator which knows how to navigate to this particular destination.

Destinations declare a set of actions that they support. These actions form a navigation API for the destination; the same actions declared on different destinations that fill similar roles allow application code to navigate based on semantic intent.

Each destination has a set of arguments that will be applied when navigating to that destination. Any default values for those arguments can be overridden at the time of navigation.

NavDestinations should be created via Navigator.createDestination.

Summary

Nested types

NavDestination.ClassType

This optional annotation allows tooling to offer auto-complete for the android:name attribute.

NavDestination.Companion

Public fields

final @NonNull Map<@NonNull String, @NonNull NavArgument>

The arguments supported by this destination.

final int

The destination's unique ID.

final CharSequence

The descriptive label of this destination.

final @NonNull String

The name associated with this destination's Navigator.

final NavGraph

Gets the NavGraph that contains this destination.

final String

The destination's unique route.

Public constructors

NavDestinations should be created via Navigator.createDestination.

NavDestination(String navigatorName)

Public methods

final void
addArgument(String argumentName, NavArgument argument)

Sets an argument type for an argument name

final void
addDeepLink(String uriPattern)

Add a deep link to this destination.

final void
addDeepLink(NavDeepLink navDeepLink)

Add a deep link to this destination.

boolean
equals(Object other)
final NavAction
getAction(@IdRes int id)

Returns the NavAction for the given action ID.

boolean
hasDeepLink(Uri deepLink)

Checks the given deep link Uri, and determines whether it matches a Uri pattern added to the destination by a call to addDeepLink .

boolean

Checks the given NavDeepLinkRequest, and determines whether it matches a NavDeepLink added to the destination by a call to addDeepLink.

int
@CallSuper void
onInflate(Context context, AttributeSet attrs)

Called when inflating a destination from a resource.

final void
putAction(@IdRes int actionId, @IdRes int destId)

Creates a NavAction for the given destId and associates it with the actionId.

final void