ActivityNavigator.Destination


@NavDestination.ClassType(value = Activity)
public class ActivityNavigator.Destination extends NavDestination


NavDestination for activity navigation

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

Summary

Public constructors

Construct a new activity destination.

Public methods

boolean
equals(Object other)
final String

The action used to start the Activity, if any

final ComponentName

The explicit ComponentName associated with this destination, if any

final Uri

The data URI used to start the Activity, if any

final String

The dynamic data URI pattern, if any

final Intent

The Intent associated with this destination.

final String

The explicit application package name associated with this destination, if any

int
void

Called when inflating a destination from a resource.

final @NonNull ActivityNavigator.Destination
setAction(String action)

Sets the action sent when navigating to this destination.

final @NonNull ActivityNavigator.Destination

Set an explicit ComponentName to navigate to.

final @NonNull ActivityNavigator.Destination
setData(Uri data)

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

final @NonNull ActivityNavigator.Destination
setDataPattern(String dataPattern)

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

final @NonNull ActivityNavigator.Destination
setIntent(Intent intent)

Set the Intent to start when navigating to this destination.

final @NonNull ActivityNavigator.Destination
setTargetPackage(String packageName)

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

@NonNull String

Inherited methods

From androidx.navigation.NavDestination
final void
addArgument(@NonNull String argumentName, @NonNull NavArgument argument)

Sets an argument type for an argument name

final void

Add a deep link to this destination.

final void
addDeepLink(@NonNull String uriPattern)

Add a deep link to this destination.

final String
fillInLabel(@NonNull Context context, Bundle bundle)

Parses a dynamic label containing arguments into a String.

final NavAction
getAction(@IdRes int id)

Returns the NavAction for the given action ID.

final @NonNull Map<@NonNull String, @NonNull NavArgument>

The arguments supported by this destination.

final @IdRes int

The destination's unique ID.

final CharSequence

The descriptive label of this destination.

final @NonNull String

The name associated with this destination's Navigator.

final NavGraph

Gets the NavGraph that contains this destination.

final String

The destination's unique route.

boolean

Checks the given NavDeepLinkRequest, and determines whether it matches a NavDeepLink added to the destination by a call to addDeepLink.

boolean
hasDeepLink(@NonNull Uri deepLink)

Checks the given deep link Uri, and determines whether it matches a Uri pattern added to the destination by a call to addDeepLink .

final void
putAction(@IdRes int actionId, @NonNull NavAction action)

Sets the NavAction destination for an action ID.

final void
putAction(@IdRes int actionId, @IdRes int destId)

Creates a NavAction for the given destId and associates it with the actionId.

final void
removeAction(@IdRes int actionId)

Unsets the NavAction for an action ID.

final void
removeArgument(@NonNull String argumentName)

Unsets the argument type for an argument name.

final void
setId(int id)

The destination's unique ID.

final void

The descriptive label of this destination.

final void

The destination's unique route.

Public constructors

Destination

Added in 1.0.0
public Destination(
    @NonNull Navigator<@NonNull ActivityNavigator.Destination> activityNavigator
)
Parameters
@NonNull Navigator<@NonNull ActivityNavigator.Destination> activityNavigator

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

Destination

Added in 1.0.0
public Destination(@NonNull NavigatorProvider navigatorProvider)

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

Parameters
@NonNull NavigatorProvider navigatorProvider

The NavController which this destination will be associated with.

Public methods

equals

public boolean equals(Object other)

getAction

Added in 1.0.0
public final String getAction()

The action used to start the Activity, if any

getComponent

Added in 1.0.0
public final ComponentName getComponent()

The explicit ComponentName associated with this destination, if any

getData

Added in 1.0.0
public final Uri getData()

The data URI used to start the Activity, if any

getDataPattern

Added in 1.0.0
public final String getDataPattern()

The dynamic data URI pattern, if any

getIntent

Added in 1.0.0
public final Intent getIntent()

The Intent associated with this destination.

getTargetPackage

Added in 2.1.0
public final String getTargetPackage()

The explicit application package name associated with this destination, if any

hashCode

public int hashCode()

onInflate

@CallSuper
public void onInflate(@NonNull Context context, @NonNull AttributeSet attrs)

Called when inflating a destination from a resource.

Parameters
@NonNull Context context

local context performing inflation

@NonNull AttributeSet attrs

attrs to parse during inflation

setAction

Added in 1.0.0
public final @NonNull ActivityNavigator.Destination setAction(String action)

Sets the action sent when navigating to this destination.

Parameters
String action

The action string to use.

setComponentName

Added in 1.0.0
public final @NonNull ActivityNavigator.Destination setComponentName(ComponentName name)

Set an explicit ComponentName to navigate to.

Parameters
ComponentName name

The component name of the Activity to start.

setData

Added in 1.0.0
public final @NonNull 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, which will take precedence when arguments are present.

When inflated from XML, you can use ${applicationId} for string interpolation to automatically use Context.getPackageName.

Parameters
Uri data

A static URI that should always be used.

See also
setDataPattern

setDataPattern

Added in 1.0.0
public final @NonNull 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.

When inflated from XML, you can use ${applicationId} as an argument pattern to automatically use Context.getPackageName.

Parameters
String 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.

See also
setData

setIntent

Added in 1.0.0
public final @NonNull ActivityNavigator.Destination setIntent(Intent intent)

Set the Intent to start when navigating to this destination.

Parameters
Intent intent

Intent to associated with this destination.

setTargetPackage

Added in 2.1.0
public final @NonNull ActivityNavigator.Destination setTargetPackage(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 Context.getPackageName.

Parameters
String packageName

packageName to set

toString

public @NonNull String toString()