ActivityNavigator.Destination


@NavDestination.ClassType(value = Activity)
open class ActivityNavigator.Destination : 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

Destination(navigatorProvider: NavigatorProvider)

Construct a new activity destination.

Public functions

open operator Boolean
equals(other: Any?)
open Int
open Unit

Called when inflating a destination from a resource.

ActivityNavigator.Destination
setAction(action: String?)

Sets the action sent when navigating to this destination.

ActivityNavigator.Destination

Set an explicit ComponentName to navigate to.

ActivityNavigator.Destination
setData(data: Uri?)

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

ActivityNavigator.Destination
setDataPattern(dataPattern: String?)

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.

ActivityNavigator.Destination
setTargetPackage(packageName: String?)

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

open String

Public properties

String?

The action used to start the Activity, if any

ComponentName?

The explicit ComponentName associated with this destination, if any

Uri?

The data URI used to start the Activity, if any

String?

The dynamic data URI pattern, if any

Intent?

The Intent associated with this destination.

String?

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

Inherited functions

From androidx.navigation.NavDestination
Unit
addArgument(argumentName: String, argument: NavArgument)

Sets an argument type for an argument name

Unit
addDeepLink(navDeepLink: NavDeepLink)

Add a deep link to this destination.

Unit
addDeepLink(uriPattern: String)

Add a deep link to this destination.

String?
fillInLabel(context: Context, bundle: SavedState?)

Parses a dynamic label containing arguments into a String.

NavAction?

Returns the NavAction for the given action ID.

open Boolean
hasDeepLink(deepLinkRequest: NavDeepLinkRequest)

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

open Boolean
hasDeepLink(deepLink: Uri)

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

Unit
putAction(actionId: @IdRes Int, action: NavAction)

Sets the NavAction destination for an action ID.

Unit
putAction(actionId: @IdRes Int, destId: @IdRes Int)

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

Unit
removeAction(actionId: @IdRes Int)

Unsets the NavAction for an action ID.

Unit
removeArgument(argumentName: String)

Unsets the argument type for an argument name.

Inherited properties

From androidx.navigation.NavDestination
Map<StringNavArgument>

The arguments supported by this destination.

Int

The destination's unique ID.

CharSequence?

The descriptive label of this destination.

String

The name associated with this destination's Navigator.

NavGraph?

Gets the NavGraph that contains this destination.

String?

The destination's unique route.

Public constructors

Destination

Added in 1.0.0
Destination(
    activityNavigator: Navigator<ActivityNavigator.Destination>
)
Parameters
activityNavigator: Navigator<ActivityNavigator.Destination>

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

Destination

Added in 1.0.0
Destination(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
navigatorProvider: NavigatorProvider

The NavController which this destination will be associated with.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

onInflate

@CallSuper
open fun onInflate(context: Context, attrs: AttributeSet): Unit

Called when inflating a destination from a resource.

Parameters
context: Context

local context performing inflation

attrs: AttributeSet

attrs to parse during inflation

setAction

Added in 1.0.0
fun setAction(action: String?): ActivityNavigator.Destination

Sets the action sent when navigating to this destination.

Parameters
action: String?

The action string to use.

setComponentName

Added in 1.0.0
fun setComponentName(name: ComponentName?): ActivityNavigator.Destination

Set an explicit ComponentName to navigate to.

Parameters
name: ComponentName?

The component name of the Activity to start.

setData

Added in 1.0.0
fun setData(data: Uri?): ActivityNavigator.Destination

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
data: Uri?

A static URI that should always be used.

See also
setDataPattern

setDataPattern

Added in 1.0.0
fun setDataPattern(dataPattern: String?): ActivityNavigator.Destination

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

See also
setData

setIntent

Added in 1.0.0
fun setIntent(intent: Intent?): ActivityNavigator.Destination

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
fun setTargetPackage(packageName: String?): ActivityNavigator.Destination

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
packageName: String?

packageName to set

toString

open fun toString(): String

Public properties

action

Added in 1.0.0
val actionString?

The action used to start the Activity, if any

component

Added in 1.0.0
val componentComponentName?

The explicit ComponentName associated with this destination, if any

data

Added in 1.0.0
val dataUri?

The data URI used to start the Activity, if any

dataPattern

Added in 1.0.0
val dataPatternString?

The dynamic data URI pattern, if any

intent

Added in 1.0.0
val intentIntent?

The Intent associated with this destination.

targetPackage

Added in 2.1.0
val targetPackageString?

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