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 @Nullable 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 @Nullable NavOptions

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

Public constructors

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

Public fields

defaultArguments

@Nullable
public final @Nullable Bundle defaultArguments

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

Returns
@Nullable Bundle

bundle of default argument values

destinationId

@IdRes
@NonNull
public final @IdRes int destinationId

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

@Nullable
public final @Nullable NavOptions navOptions

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

Public constructors

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

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

@Nullable NavOptions navOptions

special options for this action that should be used by default

@Nullable Bundle defaultArguments

argument bundle to be used by default