# NavDestination

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavDestination.+class:androidx.navigation.NavDestination) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

*** ** * ** ***


```
public class NavDestination
```

<br />

Known direct subclasses [ActivityNavigator.Destination](https://developer.android.com/reference/androidx/navigation/ActivityNavigator.Destination), [DialogFragmentNavigator.Destination](https://developer.android.com/reference/androidx/navigation/fragment/DialogFragmentNavigator.Destination), [DynamicIncludeGraphNavigator.DynamicIncludeNavGraph](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicIncludeGraphNavigator.DynamicIncludeNavGraph), [FragmentNavigator.Destination](https://developer.android.com/reference/androidx/navigation/fragment/FragmentNavigator.Destination), [NavGraph](https://developer.android.com/reference/androidx/navigation/NavGraph)

|---|---|
| `https://developer.android.com/reference/androidx/navigation/ActivityNavigator.Destination` | NavDestination for activity navigation |
| `https://developer.android.com/reference/androidx/navigation/fragment/DialogFragmentNavigator.Destination` | NavDestination specific to `https://developer.android.com/reference/androidx/navigation/fragment/DialogFragmentNavigator`. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicIncludeGraphNavigator.DynamicIncludeNavGraph` | The graph for dynamic-include. |
| `https://developer.android.com/reference/androidx/navigation/fragment/FragmentNavigator.Destination` | NavDestination specific to `https://developer.android.com/reference/androidx/navigation/fragment/FragmentNavigator` |
| `https://developer.android.com/reference/androidx/navigation/NavGraph` | NavGraph is a collection of `https://developer.android.com/reference/androidx/navigation/NavDestination` nodes fetchable by ID. |

Known indirect subclasses [DynamicActivityNavigator.Destination](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicActivityNavigator.Destination), [DynamicFragmentNavigator.Destination](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigator.Destination), [DynamicGraphNavigator.DynamicNavGraph](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicGraphNavigator.DynamicNavGraph)

|---|---|
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicActivityNavigator.Destination` | Destination for `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicActivityNavigator`. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigator.Destination` | Destination for dynamic feature navigator. |
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicGraphNavigator.DynamicNavGraph` | The `https://developer.android.com/reference/androidx/navigation/NavGraph` for dynamic features. |

*** ** * ** ***

NavDestination represents one node within an overall navigation graph.

Each destination is associated with a `https://developer.android.com/reference/androidx/navigation/Navigator` which knows how to navigate to this particular destination.

Destinations declare a set of [actions](https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,androidx.navigation.NavAction)) 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 `https://developer.android.com/reference/androidx/navigation/NavDestination#arguments()` that will be applied when `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` to that destination. Any default values for those arguments can be overridden at the time of navigation.

NavDestinations should be created via `https://developer.android.com/reference/androidx/navigation/Navigator#createDestination()`.

## Summary

| ### Nested types |
|---|
| `@https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.annotation/-retention/index.html(value = https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.annotation/-annotation-retention/-b-i-n-a-r-y/index.html) @https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.annotation/-target/index.html(allowedTargets = [https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.annotation/-annotation-target/-a-n-n-o-t-a-t-i-o-n_-c-l-a-s-s/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.annotation/-annotation-target/-c-l-a-s-s/index.html]) public annotation https://developer.android.com/reference/androidx/navigation/NavDestination.ClassType` This optional annotation allows tooling to offer auto-complete for the `android:name` attribute. |
| `public static class https://developer.android.com/reference/androidx/navigation/NavDestination.Companion` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/navigation/NavDestination#NavDestination(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html navigatorName)` |
| `https://developer.android.com/reference/androidx/navigation/NavDestination#NavDestination(androidx.navigation.Navigator)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/Navigator<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination> navigator)` NavDestinations should be created via `https://developer.android.com/reference/androidx/navigation/Navigator#createDestination()`. |

| ### Public methods |
|---|---|
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#addArgument(kotlin.String,androidx.navigation.NavArgument)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html argumentName, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavArgument argument)` Sets an argument type for an argument name |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(androidx.navigation.NavDeepLink)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDeepLink navDeepLink)` Add a deep link to this destination. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html uriPattern)` Add a deep link to this destination. |
| `boolean` | `https://developer.android.com/reference/androidx/navigation/NavDestination#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `boolean` | `https://developer.android.com/reference/androidx/navigation/NavDestination#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavDestination#fillInLabel(android.content.Context,android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/os/Bundle.html bundle)` Parses a dynamic label containing arguments into a String. |
| `final https://developer.android.com/reference/androidx/navigation/NavAction` | `https://developer.android.com/reference/androidx/navigation/NavDestination#getAction(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IdRes int id)` Returns the `https://developer.android.com/reference/androidx/navigation/NavAction` for the given action ID. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavArgument>` | `https://developer.android.com/reference/androidx/navigation/NavDestination#getArguments()()` The arguments supported by this destination. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavDestination#getDisplayName()()` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination>` | `https://developer.android.com/reference/androidx/navigation/NavDestination#(androidx.navigation.NavDestination).getHierarchy()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination receiver)` Provides a sequence of the NavDestination's hierarchy. |
| `final @https://developer.android.com/reference/androidx/annotation/IdRes int` | `https://developer.android.com/reference/androidx/navigation/NavDestination#getId()()` The destination's unique ID. |
| `final https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/navigation/NavDestination#getLabel()()` The descriptive label of this destination. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavDestination#getNavigatorName()()` The name associated with this destination's `https://developer.android.com/reference/androidx/navigation/Navigator`. |
| `final https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavDestination#getParent()()` Gets the `https://developer.android.com/reference/androidx/navigation/NavGraph` that contains this destination. |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavDestination#getRoute()()` The destination's unique route. |
| `boolean` | `https://developer.android.com/reference/androidx/navigation/NavDestination#hasDeepLink(androidx.navigation.NavDeepLinkRequest)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDeepLinkRequest deepLinkRequest)` Checks the given `https://developer.android.com/reference/androidx/navigation/NavDeepLinkRequest`, and determines whether it matches a `https://developer.android.com/reference/androidx/navigation/NavDeepLink` added to the destination by a call to `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)`. |
| `boolean` | `https://developer.android.com/reference/androidx/navigation/NavDestination#hasDeepLink(android.net.Uri)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html deepLink)` Checks the given deep link `https://developer.android.com/reference/androidx/navigation/NavUri`, and determines whether it matches a Uri pattern added to the destination by a call to `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)` . |
| `static final boolean` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavDestination#(androidx.navigation.NavDestination).hasRoute()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination receiver)` Checks if the NavDestination's `https://developer.android.com/reference/androidx/navigation/NavDestination#route()` was generated from `https://developer.android.com/reference/androidx/navigation/NavDestination.Companion#(androidx.navigation.NavDestination).hasRoute()` |
| `static final boolean` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavDestination#(androidx.navigation.NavDestination).hasRoute(kotlin.reflect.KClass)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> route )` Checks if the NavDestination's route was generated from `https://developer.android.com/reference/androidx/navigation/NavDestination.Companion#(androidx.navigation.NavDestination).hasRoute(kotlin.reflect.KClass)` |
| `int` | `https://developer.android.com/reference/androidx/navigation/NavDestination#hashCode()()` |
| `int` | `https://developer.android.com/reference/androidx/navigation/NavDestination#hashCode()()` |
| `void` | `@https://developer.android.com/reference/androidx/annotation/CallSuper https://developer.android.com/reference/androidx/navigation/NavDestination#onInflate(android.content.Context,android.util.AttributeSet)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/AttributeSet.html attrs)` Called when inflating a destination from a resource. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,androidx.navigation.NavAction)(@https://developer.android.com/reference/androidx/annotation/IdRes int actionId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavAction action)` Sets the `https://developer.android.com/reference/androidx/navigation/NavAction` destination for an action ID. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IdRes int actionId, @https://developer.android.com/reference/androidx/annotation/IdRes int destId)` Creates a `https://developer.android.com/reference/androidx/navigation/NavAction` for the given `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)` and associates it with the `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)`. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#removeAction(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IdRes int actionId)` Unsets the `https://developer.android.com/reference/androidx/navigation/NavAction` for an action ID. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#removeArgument(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html argumentName)` Unsets the argument type for an argument name. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#setId(kotlin.Int)(int value)` The destination's unique ID. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#setLabel(kotlin.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html value)` The descriptive label of this destination. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#setParent(androidx.navigation.NavGraph)(https://developer.android.com/reference/androidx/navigation/NavGraph value)` Gets the `https://developer.android.com/reference/androidx/navigation/NavGraph` that contains this destination. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavDestination#setRoute(kotlin.String)(https://developer.android.com/reference/java/lang/String.html value)` The destination's unique route. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavDestination#toString()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavDestination#toString()()` |

| ### Protected methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<C>` | `<C extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavDestination#parseClassFromName(android.content.Context,kotlin.String,java.lang.Class)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<C> expectedClassType )` Parse the class associated with this destination from a raw name, generally extracted from the `android:name` attribute added to the destination's XML. |

## Public constructors

### NavDestination

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public NavDestination(@NonNull String navigatorName)
```

### NavDestination

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public NavDestination(@NonNull Navigator<@NonNull NavDestination> navigator)
```

NavDestinations should be created via `https://developer.android.com/reference/androidx/navigation/Navigator#createDestination()`.

This constructor requires that the given Navigator has a `https://developer.android.com/reference/androidx/navigation/Navigator.Name` annotation.

## Public methods

### addArgument

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

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

Sets an argument type for an argument name

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html argumentName` | argument object to associate with destination |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavArgument argument` | argument object to associate with destination |

### addDeepLink

Added in [2.3.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.3.0)

```
public final void addDeepLink(@NonNull NavDeepLink navDeepLink)
```

Add a deep link to this destination. Uris that match the given `https://developer.android.com/reference/androidx/navigation/NavDeepLink` uri sent to `https://developer.android.com/reference/androidx/navigation/NavController#handleDeepLink(androidx.navigation.NavDeepLinkRequest)` or `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` will trigger navigating to this destination.

In addition to a direct Uri match, the following features are supported:

Uris without a scheme are assumed as http and https. For example, `www.example.com` will match `http://www.example.com` and `https://www.example.com`. Placeholders in the form of `{placeholder_name}` matches 1 or more characters. The String value of the placeholder will be available in the arguments `https://developer.android.com/reference/androidx/savedstate/SavedState` with a key of the same name. For example, `http://www.example.com/users/{id}` will match `http://www.example.com/users/4`. The `.*` wildcard can be used to match 0 or more characters.

These Uris can be declared in your navigation XML files by adding one or more `<deepLink app:uri="uriPattern" />` elements as a child to your destination.

Custom actions and mimetypes are also supported by `https://developer.android.com/reference/androidx/navigation/NavDeepLink` and can be declared in your navigation XML files by adding `<app:action="android.intent.action.SOME_ACTION" />` or `<app:mimetype="type/subtype" />` as part of your deepLink declaration.

Deep link Uris, actions, and mimetypes added in navigation XML files will automatically replace instances of `${applicationId}` with the applicationId of your app. Programmatically added deep links should use [Context.getPackageName](https://developer.android.com/reference/android/content/Context#getPackageManager()) directly when constructing the uriPattern.

When matching deep links for calls to `https://developer.android.com/reference/androidx/navigation/NavController#handleDeepLink(androidx.navigation.NavDeepLinkRequest)` or `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` the order of precedence is as follows: the deep link with the most matching arguments will be chosen, followed by the deep link with a matching action, followed by the best matching mimeType (e.i. when matching mimeType image/jpg: image/ \* \> \*\\/jpg \> \*\\/ \*).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDeepLink navDeepLink` | The NavDeepLink to add as a deep link |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavController#handleDeepLink(androidx.navigation.NavDeepLinkRequest)` |   |
| `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` |   |

### addDeepLink

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void addDeepLink(@NonNull String uriPattern)
```

Add a deep link to this destination. Matching Uris sent to `https://developer.android.com/reference/androidx/navigation/NavController#handleDeepLink(androidx.navigation.NavDeepLinkRequest)` or `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` will trigger navigating to this destination.

In addition to a direct Uri match, the following features are supported:

- Uris without a scheme are assumed as http and https. For example, `www.example.com` will match `http://www.example.com` and `https://www.example.com`.

- Placeholders in the form of `{placeholder_name}` matches 1 or more characters. The parsed value of the placeholder will be available in the arguments `https://developer.android.com/reference/androidx/savedstate/SavedState` with a key of the same name. For example, `http://www.example.com/users/{id}` will match `http://www.example.com/users/4`.

- The `.*` wildcard can be used to match 0 or more characters.

These Uris can be declared in your navigation XML files by adding one or more `<deepLink app:uri="uriPattern" />` elements as a child to your destination.

Deep links added in navigation XML files will automatically replace instances of `${applicationId}` with the applicationId of your app. Programmatically added deep links should use [Context.getPackageName](https://developer.android.com/reference/android/content/Context#getPackageManager()) directly when constructing the uriPattern.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html uriPattern` | The uri pattern to add as a deep link |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavController#handleDeepLink(androidx.navigation.NavDeepLinkRequest)` |   |
| `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` |   |
| `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)` |   |

### equals

```
public boolean equals(Object other)
```

### equals

```
public boolean equals(Object other)
```

### fillInLabel

Added in [2.6.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.6.0)

```
public final String fillInLabel(@NonNull Context context, Bundle bundle)
```

Parses a dynamic label containing arguments into a String.

Supports String Resource arguments by parsing `R.string` values of `ReferenceType` arguments found in `android:label` into their String values.

Returns `null` if label is null.

Returns the original label if the label was a static string.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | Context used to resolve a resource's name |
| `https://developer.android.com/reference/android/os/Bundle.html bundle` | SavedState containing the arguments used in the label |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | The parsed string or null if the label is null |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if an argument provided in the label cannot be found in the bundle, or if the label contains a string template but the bundle is null |

### getAction

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final NavAction getAction(@IdRes int id)
```

Returns the `https://developer.android.com/reference/androidx/navigation/NavAction` for the given action ID. This will recursively check the `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` of this destination if the action destination is not found in this destination.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int id` | action ID to fetch |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavAction` | the `https://developer.android.com/reference/androidx/navigation/NavAction` mapped to the given action id, or null if one has not been set |

### getArguments

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final @NonNull Map<@NonNull String, @NonNull NavArgument> getArguments()
```

The arguments supported by this destination. Returns a read-only map of argument names to `https://developer.android.com/reference/androidx/navigation/NavArgument` objects that can be used to check the type, default value and nullability of the argument.

To add and remove arguments for this NavDestination use `https://developer.android.com/reference/androidx/navigation/NavDestination#addArgument(kotlin.String,androidx.navigation.NavArgument)` and `https://developer.android.com/reference/androidx/navigation/NavDestination#removeArgument(kotlin.String)`.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavArgument>` | Read-only map of argument names to arguments. |

### getDisplayName

```
public @NonNull String getDisplayName()
```

### getHierarchy

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public static final @NonNull Sequence<@NonNull NavDestination> getHierarchy(@NonNull NavDestination receiver)
```

Provides a sequence of the NavDestination's hierarchy. The hierarchy starts with this destination itself and is then followed by this destination's `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()`, then that graph's parent, and up the hierarchy until you've reached the root navigation graph.

### getId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final @IdRes int getId()
```

The destination's unique ID. This should be an ID resource generated by the Android resource system.

If using safe args, setting this manually will override the ID that was set based on route from KClass.

### getLabel

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final CharSequence getLabel()
```

The descriptive label of this destination.

### getNavigatorName

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final @NonNull String getNavigatorName()
```

The name associated with this destination's `https://developer.android.com/reference/androidx/navigation/Navigator`.

### getParent

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final NavGraph getParent()
```

Gets the `https://developer.android.com/reference/androidx/navigation/NavGraph` that contains this destination. This will be set when a destination is added to a NavGraph via `https://developer.android.com/reference/androidx/navigation/NavGraph#addDestination(androidx.navigation.NavDestination)`.

### getRoute

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public final String getRoute()
```

The destination's unique route. Setting this will also update the `https://developer.android.com/reference/androidx/navigation/NavDestination#id()` of the destinations so custom destination ids should only be set after setting the route.

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | this destination's route, or null if no route is set |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | is the given route is empty |

### hasDeepLink

Added in [2.3.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.3.0)

```
public boolean hasDeepLink(@NonNull NavDeepLinkRequest deepLinkRequest)
```

Checks the given `https://developer.android.com/reference/androidx/navigation/NavDeepLinkRequest`, and determines whether it matches a `https://developer.android.com/reference/androidx/navigation/NavDeepLink` added to the destination by a call to `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)`. It returns `true` if the request is a valid match, and `false` otherwise.

This should be called prior to `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` to ensure the deep link can be navigated to.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDeepLinkRequest deepLinkRequest` | to the destination reachable from the current NavGraph |

| Returns |
|---|---|
| `boolean` | True if the deepLink exists for the destination. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)` |   |
| `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` |   |

### hasDeepLink

Added in [2.1.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.1.0)

```
public boolean hasDeepLink(@NonNull Uri deepLink)
```

Checks the given deep link `https://developer.android.com/reference/androidx/navigation/NavUri`, and determines whether it matches a Uri pattern added to the destination by a call to `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)` . It returns `true` if the deep link is a valid match, and `false` otherwise.

This should be called prior to `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` to ensure the deep link can be navigated to.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html deepLink` | to the destination reachable from the current NavGraph |

| Returns |
|---|---|
| `boolean` | True if the deepLink exists for the destination. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)` |   |
| `https://developer.android.com/reference/androidx/navigation/NavController#navigate(androidx.navigation.NavUri)` |   |
| `https://developer.android.com/reference/androidx/navigation/NavDestination#hasDeepLink(androidx.navigation.NavUri)` |   |

### hasRoute

```
public static final boolean <T extends Object> hasRoute(@NonNull NavDestination receiver)
```

Checks if the NavDestination's `https://developer.android.com/reference/androidx/navigation/NavDestination#route()` was generated from `https://developer.android.com/reference/androidx/navigation/NavDestination.Companion#(androidx.navigation.NavDestination).hasRoute()`

Returns true if equal, false otherwise.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | the route from KClass |

### hasRoute

Added in [2.8.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.8.0)

```
public static final boolean <T extends Object> hasRoute(
    @NonNull NavDestination receiver,
    @NonNull KClass<@NonNull T> route
)
```

Checks if the NavDestination's route was generated from `https://developer.android.com/reference/androidx/navigation/NavDestination.Companion#(androidx.navigation.NavDestination).hasRoute(kotlin.reflect.KClass)`

Returns true if equal, false otherwise.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> route` | the route from KClass |

### hashCode

```
public int hashCode()
```

### hashCode

```
public int hashCode()
```

### onInflate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
@CallSuper
public void onInflate(@NonNull Context context, @NonNull AttributeSet attrs)
```

Called when inflating a destination from a resource.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | local context performing inflation |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/AttributeSet.html attrs` | attrs to parse during inflation |

### putAction

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void putAction(@IdRes int actionId, @NonNull NavAction action)
```

Sets the `https://developer.android.com/reference/androidx/navigation/NavAction` destination for an action ID.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int actionId` | action ID to bind |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavAction action` | action to associate with this action ID |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | this destination is considered a terminal destination and does not support actions |

### putAction

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

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

Creates a `https://developer.android.com/reference/androidx/navigation/NavAction` for the given `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)` and associates it with the `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int actionId` | action ID to bind |
| `@https://developer.android.com/reference/androidx/annotation/IdRes int destId` | destination ID for the given action |

### removeAction

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void removeAction(@IdRes int actionId)
```

Unsets the `https://developer.android.com/reference/androidx/navigation/NavAction` for an action ID.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int actionId` | action ID to remove |

### removeArgument

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void removeArgument(@NonNull String argumentName)
```

Unsets the argument type for an argument name.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html argumentName` | argument to remove |

### setId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void setId(int value)
```

The destination's unique ID. This should be an ID resource generated by the Android resource system.

If using safe args, setting this manually will override the ID that was set based on route from KClass.

### setLabel

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void setLabel(CharSequence value)
```

The descriptive label of this destination.

### setParent

```
public final void setParent(NavGraph value)
```

Gets the `https://developer.android.com/reference/androidx/navigation/NavGraph` that contains this destination. This will be set when a destination is added to a NavGraph via `https://developer.android.com/reference/androidx/navigation/NavGraph#addDestination(androidx.navigation.NavDestination)`.

### setRoute

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public final void setRoute(String value)
```

The destination's unique route. Setting this will also update the `https://developer.android.com/reference/androidx/navigation/NavDestination#id()` of the destinations so custom destination ids should only be set after setting the route.

| Returns |
|---|---|
| `void` | this destination's route, or null if no route is set |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | is the given route is empty |

### toString

```
public @NonNull String toString()
```

### toString

```
public @NonNull String toString()
```

## Protected methods

### parseClassFromName

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
protected static final @NonNull Class<C> <C extends Object> parseClassFromName(
    @NonNull Context context,
    @NonNull String name,
    @NonNull Class<C> expectedClassType
)
```

Parse the class associated with this destination from a raw name, generally extracted from the `android:name` attribute added to the destination's XML. This should be the class providing the visual representation of the destination that the user sees after navigating to this destination.

This method does name -\> Class caching and should be strongly preferred over doing your own parsing if your `https://developer.android.com/reference/androidx/navigation/Navigator` supports the `android:name` attribute to give consistent behavior across all Navigators.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | Context providing the package name for use with relative class names and the ClassLoader |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name` | Absolute or relative class name. Null names will be ignored. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<C> expectedClassType` | The expected class type |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<C>` | The parsed class |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the class is not found in the provided Context's ClassLoader or if the class is not of the expected type |