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 @Nullable CharSequence

The descriptive label of this destination.

final @NonNull String

The name associated with this destination's Navigator.

final @Nullable NavGraph

Gets the NavGraph that contains this destination.

final @Nullable String

The destination's unique route.

Public constructors

NavDestinations should be created via Navigator.createDestination.

NavDestination(@NonNull String navigatorName)

Public methods

final void
addArgument(@NonNull String argumentName, @NonNull NavArgument argument)

Sets an argument type for an argument name

final void
addDeepLink(@NonNull String uriPattern)

Add a deep link to this destination.

final void

Add a deep link to this destination.

boolean
final @Nullable NavAction
getAction(@IdRes int id)

Returns the NavAction for the given action ID.

boolean
hasDeepLink(@NonNull 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.