# NavAction

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/navigation/NavAction "View this page in Java")
Common/AllAndroid/JVM
  - android  

  ```
  class NavAction
  ```

*** ** * ** ***

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[NavOptions](https://developer.android.com/reference/kotlin/androidx/navigation/NavOptions)based on the current[NavDestination](https://developer.android.com/reference/kotlin/androidx/navigation/NavDestination).

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

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

## Summary

|                                                                                                                                                                                                                                                                            ### Public constructors                                                                                                                                                                                                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| [NavAction](https://developer.android.com/reference/kotlin/androidx/navigation/NavAction#NavAction(kotlin.Int,androidx.navigation.NavOptions,android.os.Bundle))`(` ` destinationId: @`[IdRes](https://developer.android.com/reference/kotlin/androidx/annotation/IdRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` navOptions: `[NavOptions](https://developer.android.com/reference/kotlin/androidx/navigation/NavOptions)`?,` ` defaultArguments: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?` `)` | android |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/navigation/NavAction#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` | android |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/navigation/NavAction#hashCode())`()`                                                                                            | android |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/navigation/NavAction#toString())`()`                                                                                            | android |

|                                                                       ### Public properties                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`                                                                                        | [defaultArguments](https://developer.android.com/reference/kotlin/androidx/navigation/NavAction#defaultArguments()) The argument SavedState to be used by default when navigating to this action. | android |
| `@`[IdRes](https://developer.android.com/reference/kotlin/androidx/annotation/IdRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [destinationId](https://developer.android.com/reference/kotlin/androidx/navigation/NavAction#destinationId()) The ID of the destination that should be navigated to when this action is used      | android |
| [NavOptions](https://developer.android.com/reference/kotlin/androidx/navigation/NavOptions)`?`                                                                     | [navOptions](https://developer.android.com/reference/kotlin/androidx/navigation/NavAction#navOptions()) The NavOptions to be used by default when navigating to this action.                      | android |

## Public constructors

### NavAction

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

```
NavAction(
    destinationId: @IdRes Int,
    navOptions: NavOptions? = null,
    defaultArguments: Bundle? = null
)
```  

|                                                                                    Parameters                                                                                     |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| `destinationId: @`[IdRes](https://developer.android.com/reference/kotlin/androidx/annotation/IdRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the ID of the destination that should be navigated to when this action is used. |
| `navOptions: `[NavOptions](https://developer.android.com/reference/kotlin/androidx/navigation/NavOptions)`? = null`                                                               | special options for this action that should be used by default                  |
| `defaultArguments: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`? = null`                                                                            | argument SavedState to be used by default                                       |

## Public functions

### equals

android  

```
open operator fun equals(other: Any?): Boolean
```  

### hashCode

android  

```
open fun hashCode(): Int
```  

### toString

android  

```
open fun toString(): String
```

## Public properties

### defaultArguments

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

```
var defaultArguments: Bundle?
```

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

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

### destinationId

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

```
val destinationId: @IdRes Int
```

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

### navOptions

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

```
var navOptions: NavOptions?
```

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