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,
    Bundle defaultArguments
)

Public methods

boolean
equals(Object other)
final Bundle

The argument bundle 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(Bundle defaultArguments)

The argument bundle 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

Added in 1.0.0
public 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

Public methods

equals

public boolean equals(Object other)

getDefaultArguments

Added in 1.0.0
public final Bundle getDefaultArguments()

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

Returns
Bundle

bundle 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

Added in 1.0.0
public final void setDefaultArguments(Bundle defaultArguments)

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

Returns
void

bundle 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()