NavAction

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

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

Actions should be added via NavDestination.putAction or NavDestination.putAction.

Summary

Public fields

final Bundle

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

final @IdRes int

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

final NavOptions

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

Public constructors

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

Public fields

defaultArguments

public final Bundle defaultArguments

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

Returns
Bundle

bundle of default argument values

destinationId

public final @IdRes int destinationId

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

public final NavOptions navOptions

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

Public constructors

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

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

NavOptions navOptions

special options for this action that should be used by default

Bundle defaultArguments

argument bundle to be used by default