NavAction
public
final
class
NavAction
extends Object
java.lang.Object | |
↳ | androidx.navigation.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(int)
or
NavController.navigate(int, Bundle)
.
Actions should be added via NavDestination.putAction(int, int)
or
NavDestination.putAction(int, NavAction)
.
Summary
Public constructors | |
---|---|
NavAction(int destinationId)
Creates a new NavAction for the given destination. |
|
NavAction(int destinationId, NavOptions navOptions)
Creates a new NavAction for the given destination. |
|
NavAction(int destinationId, NavOptions navOptions, Bundle defaultArgs)
Creates a new NavAction for the given destination. |
Public methods | |
---|---|
Bundle
|
getDefaultArguments()
Gets the argument bundle to be used by default when navigating to this action. |
int
|
getDestinationId()
Gets the ID of the destination that should be navigated to when this action is used |
NavOptions
|
getNavOptions()
Gets the NavOptions to be used by default when navigating to this action. |
void
|
setDefaultArguments(Bundle defaultArgs)
Sets the argument bundle to be used by default when navigating to this action. |
void
|
setNavOptions(NavOptions navOptions)
Sets the NavOptions to be used by default when navigating to this action. |
Inherited methods | |
---|---|
Public constructors
NavAction
public NavAction (int destinationId)
Creates a new NavAction for the given destination.
Parameters | |
---|---|
destinationId |
int : the ID of the destination that should be navigated to when this
action is used.
|
NavAction
public NavAction (int destinationId, NavOptions navOptions)
Creates a new NavAction for the given destination.
Parameters | |
---|---|
destinationId |
int : 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
|
NavAction
public NavAction (int destinationId, NavOptions navOptions, Bundle defaultArgs)
Creates a new NavAction for the given destination.
Parameters | |
---|---|
destinationId |
int : 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 |
defaultArgs |
Bundle : argument bundle to be used by default
|
Public methods
getDefaultArguments
public Bundle getDefaultArguments ()
Gets the argument bundle to be used by default when navigating to this action.
Returns | |
---|---|
Bundle |
bundle of default argument values |
getDestinationId
public int getDestinationId ()
Gets the ID of the destination that should be navigated to when this action is used
Returns | |
---|---|
int |
getNavOptions
public NavOptions getNavOptions ()
Gets the NavOptions to be used by default when navigating to this action.
Returns | |
---|---|
NavOptions |
setDefaultArguments
public void setDefaultArguments (Bundle defaultArgs)
Sets the argument bundle to be used by default when navigating to this action.
Parameters | |
---|---|
defaultArgs |
Bundle : argument bundle that should be used by default
|
setNavOptions
public void setNavOptions (NavOptions navOptions)
Sets the NavOptions to be used by default when navigating to this action.
Parameters | |
---|---|
navOptions |
NavOptions : special options for this action that should be used by default
|