ActivityNavigator.Destination

public static class ActivityNavigator.Destination
extends NavDestination

java.lang.Object
   ↳ androidx.navigation.NavDestination
     ↳ androidx.navigation.ActivityNavigator.Destination


NavDestination for activity navigation

Summary

Public constructors

ActivityNavigator.Destination(NavigatorProvider navigatorProvider)

Construct a new activity destination.

ActivityNavigator.Destination(Navigator<? extends ActivityNavigator.Destination> activityNavigator)

Construct a new activity destination.

Public methods

String getAction()

Get the action used to start the Activity, if any

ComponentName getComponent()

Get the explicit ComponentName associated with this destination, if any

Uri getData()

Get the data URI used to start the Activity, if any

String getDataPattern()

Gets the dynamic data URI pattern, if any

Intent getIntent()

Gets the Intent associated with this destination.

void onInflate(Context context, AttributeSet attrs)

Called when inflating a destination from a resource.

void putAction(int actionId, NavAction action)

Sets a destination ID for an action ID.

ActivityNavigator.Destination setAction(String action)

Sets the action sent when navigating to this destination.

ActivityNavigator.Destination setComponentName(ComponentName name)

Set an explicit ComponentName to navigate to.

ActivityNavigator.Destination setData(Uri data)

Sets a static data URI that is sent when navigating to this destination.

ActivityNavigator.Destination setDataPattern(String dataPattern)

Sets a dynamic data URI pattern that is sent when navigating to this destination.

ActivityNavigator.Destination setIntent(Intent intent)

Set the Intent to start when navigating to this destination.

Inherited methods

Public constructors

ActivityNavigator.Destination

public ActivityNavigator.Destination (NavigatorProvider navigatorProvider)

Construct a new activity destination. This destination is not valid until you set the Intent via setIntent(Intent) or one or more of the other set method.

Parameters
navigatorProvider NavigatorProvider: The NavController which this destination will be associated with.

ActivityNavigator.Destination

public ActivityNavigator.Destination (Navigator<? extends ActivityNavigator.Destination> activityNavigator)

Construct a new activity destination. This destination is not valid until you set the Intent via setIntent(Intent) or one or more of the other set method.

Parameters
activityNavigator Navigator: The ActivityNavigator which this destination will be associated with. Generally retrieved via a NavController's NavigatorProvider.getNavigator(Class) method.

Public methods

getAction

public String getAction ()

Get the action used to start the Activity, if any

Returns
String

getComponent

public ComponentName getComponent ()

Get the explicit ComponentName associated with this destination, if any

Returns
ComponentName

getData

public Uri getData ()

Get the data URI used to start the Activity, if any

Returns
Uri

getDataPattern

public String getDataPattern ()

Gets the dynamic data URI pattern, if any

Returns
String

getIntent

public Intent getIntent ()

Gets the Intent associated with this destination.

Returns
Intent

onInflate

public void onInflate (Context context, 
                AttributeSet attrs)

Called when inflating a destination from a resource.

Parameters
context Context: local context performing inflation

attrs AttributeSet: attrs to parse during inflation

putAction

public void putAction (int actionId, 
                NavAction action)

Sets a destination ID for an action ID.

Parameters
actionId int: action ID to bind

action NavAction: action to associate with this action ID

setAction

public ActivityNavigator.Destination setAction (String action)

Sets the action sent when navigating to this destination.

Parameters
action String: The action string to use.

Returns
ActivityNavigator.Destination this ActivityNavigator.Destination

setComponentName

public ActivityNavigator.Destination setComponentName (ComponentName name)

Set an explicit ComponentName to navigate to.

Parameters
name ComponentName: The component name of the Activity to start.

Returns
ActivityNavigator.Destination this ActivityNavigator.Destination

setData

public ActivityNavigator.Destination setData (Uri data)

Sets a static data URI that is sent when navigating to this destination.

To use a dynamic URI that changes based on the arguments passed in when navigating, use setDataPattern(String), which will take precedence when arguments are present.

Parameters
data Uri: A static URI that should always be used.

Returns
ActivityNavigator.Destination this ActivityNavigator.Destination

setDataPattern

public ActivityNavigator.Destination setDataPattern (String dataPattern)

Sets a dynamic data URI pattern that is sent when navigating to this destination.

If a non-null arguments Bundle is present when navigating, any segments in the form {argName} will be replaced with a URI encoded string from the arguments.

Parameters
dataPattern String: A URI pattern with segments in the form of {argName} that will be replaced with URI encoded versions of the Strings in the arguments Bundle.

Returns
ActivityNavigator.Destination this ActivityNavigator.Destination

See also:

setIntent

public ActivityNavigator.Destination setIntent (Intent intent)

Set the Intent to start when navigating to this destination.

Parameters
intent Intent: Intent to associated with this destination.

Returns
ActivityNavigator.Destination this ActivityNavigator.Destination