public class

ActivityNavigator.Destination

extends NavDestination

 java.lang.Object

androidx.navigation.NavDestination

↳androidx.navigation.ActivityNavigator.Destination

Overview

NavDestination for activity navigation

Summary

Constructors
publicDestination(Navigator<ActivityNavigator.Destination> activityNavigator)

Construct a new activity destination.

publicDestination(NavigatorProvider navigatorProvider)

Construct a new activity destination.

Methods
public final java.lang.StringgetAction()

Get the action used to start the Activity, if any

public final ComponentNamegetComponent()

Get the explicit associated with this destination, if any

public final UrigetData()

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

public final java.lang.StringgetDataPattern()

Gets the dynamic data URI pattern, if any

public final IntentgetIntent()

Gets the Intent associated with this destination.

public final java.lang.StringgetTargetPackage()

Get the explicit application package name associated with this destination, if any

public voidonInflate(Context context, AttributeSet attrs)

Called when inflating a destination from a resource.

public final ActivityNavigator.DestinationsetAction(java.lang.String action)

Sets the action sent when navigating to this destination.

public final ActivityNavigator.DestinationsetComponentName(ComponentName name)

Set an explicit to navigate to.

public final ActivityNavigator.DestinationsetData(Uri data)

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

public final ActivityNavigator.DestinationsetDataPattern(java.lang.String dataPattern)

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

public final ActivityNavigator.DestinationsetIntent(Intent intent)

Set the Intent to start when navigating to this destination.

public final ActivityNavigator.DestinationsetTargetPackage(java.lang.String packageName)

Set an explicit application package name that limits the components this destination will navigate to.

public java.lang.StringtoString()

from NavDestinationaddArgument, addDeepLink, addDeepLink, getAction, getArguments, getDisplayName, getId, getLabel, getNavigatorName, getParent, hasDeepLink, parseClassFromName, putAction, putAction, removeAction, removeArgument, setId, setLabel
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructors

public Destination(NavigatorProvider navigatorProvider)

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

Parameters:

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

public Destination(Navigator<ActivityNavigator.Destination> activityNavigator)

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

Parameters:

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

Methods

public void onInflate(Context context, AttributeSet attrs)

Called when inflating a destination from a resource.

Parameters:

context: local context performing inflation
attrs: attrs to parse during inflation

public final ActivityNavigator.Destination setIntent(Intent intent)

Set the Intent to start when navigating to this destination.

Parameters:

intent: Intent to associated with this destination.

Returns:

this ActivityNavigator.Destination

public final Intent getIntent()

Gets the Intent associated with this destination.

Returns:

public final ActivityNavigator.Destination setTargetPackage(java.lang.String packageName)

Set an explicit application package name that limits the components this destination will navigate to.

When inflated from XML, you can use ${applicationId} as the package name to automatically use .

Parameters:

packageName: packageName to set

Returns:

this ActivityNavigator.Destination

public final java.lang.String getTargetPackage()

Get the explicit application package name associated with this destination, if any

public final ActivityNavigator.Destination setComponentName(ComponentName name)

Set an explicit to navigate to.

Parameters:

name: The component name of the Activity to start.

Returns:

this ActivityNavigator.Destination

public final ComponentName getComponent()

Get the explicit associated with this destination, if any

Returns:

public final ActivityNavigator.Destination setAction(java.lang.String action)

Sets the action sent when navigating to this destination.

Parameters:

action: The action string to use.

Returns:

this ActivityNavigator.Destination

public final java.lang.String getAction()

Get the action used to start the Activity, if any

public final 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 ActivityNavigator.Destination.setDataPattern(String), which will take precedence when arguments are present.

Parameters:

data: A static URI that should always be used.

Returns:

this ActivityNavigator.Destination

See also: ActivityNavigator.Destination.setDataPattern(String)

public final Uri getData()

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

public final ActivityNavigator.Destination setDataPattern(java.lang.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: 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:

this ActivityNavigator.Destination

See also: ActivityNavigator.Destination.setData(Uri)

public final java.lang.String getDataPattern()

Gets the dynamic data URI pattern, if any

public java.lang.String toString()