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.

Actions should be added via NavDestination.putAction.

Summary

Public constructors

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

Public methods

boolean
equals(Object other)
final SavedState

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

final 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.

int
final void
setDefaultArguments(SavedState defaultArguments)

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

final void

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

@NonNull String

Public constructors

public NavAction(
    @IdRes int destinationId,
    NavOptions navOptions,
    SavedState 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

SavedState defaultArguments

argument SavedState to be used by default

Public methods

equals

public boolean equals(Object other)

getDefaultArguments

Added in 1.0.0
public final SavedState getDefaultArguments()

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

Returns
SavedState

SavedState of default argument values

getDestinationId

Added in 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
public final NavOptions getNavOptions()

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

hashCode

public int hashCode()

setDefaultArguments

public final void setDefaultArguments(SavedState defaultArguments)

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
public final void setNavOptions(NavOptions navOptions)

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

toString

public @NonNull String toString()