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 based on the current NavDestination.

The NavOptions associated with a NavAction are used by default when navigating to this action via NavController.navigate.

Actions should be added via NavDestination.putAction.

Summary

Public constructors

NavAction(
    destinationId: @IdRes Int,
    navOptions: NavOptions?,
    defaultArguments: Bundle?
)
android

Public functions

open operator Boolean
equals(other: Any?)
android
open Int
android
open String
android

Public properties

Bundle?

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

android
@IdRes Int

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

android
NavOptions?

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

android

Public constructors

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

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

navOptions: NavOptions? = null

special options for this action that should be used by default

defaultArguments: Bundle? = null

argument SavedState to be used by default

Public functions

equals

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

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

defaultArguments

var defaultArgumentsBundle?

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

Returns
Bundle?

SavedState of default argument values

destinationId

val destinationId: @IdRes Int

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

var navOptionsNavOptions?

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