# NavAction

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

*** ** * ** ***


```
public final class NavAction
```

<br />

*** ** * ** ***

Navigation actions provide a level of indirection between your navigation code and the underlying destinations. This allows you to define common actions that change their destination or `https://developer.android.com/reference/androidx/navigation/NavOptions` based on the current `https://developer.android.com/reference/androidx/navigation/NavDestination`.

The `https://developer.android.com/reference/androidx/navigation/NavOptions` associated with a NavAction are used by default when navigating to this action via `https://developer.android.com/reference/androidx/navigation/NavController#navigate(kotlin.Int)`.

Actions should be added via `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/navigation/NavAction#NavAction(kotlin.Int,androidx.navigation.NavOptions,android.os.Bundle)( @https://developer.android.com/reference/androidx/annotation/IdRes int destinationId, https://developer.android.com/reference/androidx/navigation/NavOptions navOptions, https://developer.android.com/reference/android/os/Bundle.html defaultArguments )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/navigation/NavAction#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/navigation/NavAction#getDefaultArguments()()` The argument SavedState to be used by default when navigating to this action. |
| `final int` | `https://developer.android.com/reference/androidx/navigation/NavAction#getDestinationId()()` The ID of the destination that should be navigated to when this action is used |
| `final https://developer.android.com/reference/androidx/navigation/NavOptions` | `https://developer.android.com/reference/androidx/navigation/NavAction#getNavOptions()()` The NavOptions to be used by default when navigating to this action. |
| `int` | `https://developer.android.com/reference/androidx/navigation/NavAction#hashCode()()` |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavAction#setDefaultArguments(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html value)` The argument SavedState to be used by default when navigating to this action. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavAction#setNavOptions(androidx.navigation.NavOptions)(https://developer.android.com/reference/androidx/navigation/NavOptions value)` The NavOptions to be used by default when navigating to this action. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavAction#toString()()` |

## Public constructors

### NavAction

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

```
public NavAction(
    @IdRes int destinationId,
    NavOptions navOptions,
    Bundle defaultArguments
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int destinationId` | the ID of the destination that should be navigated to when this action is used. |
| `https://developer.android.com/reference/androidx/navigation/NavOptions navOptions` | special options for this action that should be used by default |
| `https://developer.android.com/reference/android/os/Bundle.html defaultArguments` | argument SavedState to be used by default |

## Public methods

### equals

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

### getDefaultArguments

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

```
public final Bundle getDefaultArguments()
```

The argument SavedState to be used by default when navigating to this action.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | SavedState of default argument values |

### getDestinationId

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

```
public final int getDestinationId()
```

The ID of the destination that should be navigated to when this action is used

### getNavOptions

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

```
public final NavOptions getNavOptions()
```

The NavOptions to be used by default when navigating to this action.

### hashCode

```
public int hashCode()
```

### setDefaultArguments

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

```
public final void setDefaultArguments(Bundle value)
```

The argument SavedState to be used by default when navigating to this action.

| Returns |
|---|---|
| `void` | SavedState of default argument values |

### setNavOptions

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

```
public final void setNavOptions(NavOptions value)
```

The NavOptions to be used by default when navigating to this action.

### toString

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