ActivityNavigator.Destination
@NavDestination.ClassType(value = Activity)
public class ActivityNavigator.Destination extends NavDestination
| java.lang.Object | ||
| ↳ | androidx.navigation.NavDestination | |
| ↳ | androidx.navigation.ActivityNavigator.Destination |
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( |
Destination(@NonNull NavigatorProvider navigatorProvider)Construct a new activity destination. |
Public methods |
|
|---|---|
boolean |
|
final String |
The action used to start the Activity, if any |
final ComponentName |
The explicit |
final Uri |
getData()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 |
hashCode() |
void |
Called when inflating a destination from a resource. |
final @NonNull ActivityNavigator.Destination |
Sets the action sent when navigating to this destination. |
final @NonNull ActivityNavigator.Destination |
Set an explicit |
final @NonNull ActivityNavigator.Destination |
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 |
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 |
toString() |
Inherited methods |
||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
Destination
public Destination(
@NonNull Navigator<@NonNull ActivityNavigator.Destination> activityNavigator
)
| Parameters | |
|---|---|
@NonNull Navigator<@NonNull ActivityNavigator.Destination> activityNavigator |
The |
Destination
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 |
Public methods
getAction
public final String getAction()
The action used to start the Activity, if any
getComponent
public final ComponentName getComponent()
The explicit ComponentName associated with this destination, if any
getDataPattern
public final String getDataPattern()
The dynamic data URI pattern, if any
getIntent
public final Intent getIntent()
The Intent associated with this destination.
getTargetPackage
public final String getTargetPackage()
The explicit application package name associated with this destination, if any
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
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. |
| Returns | |
|---|---|
@NonNull ActivityNavigator.Destination |
this |
setComponentName
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. |
| Returns | |
|---|---|
@NonNull ActivityNavigator.Destination |
this |
setData
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. |
| Returns | |
|---|---|
@NonNull ActivityNavigator.Destination |
this |
| See also | |
|---|---|
setDataPattern |
setDataPattern
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 |
| Returns | |
|---|---|
@NonNull ActivityNavigator.Destination |
this |
| See also | |
|---|---|
setData |
setIntent
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. |
| Returns | |
|---|---|
@NonNull ActivityNavigator.Destination |
this |
setTargetPackage
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 |
| Returns | |
|---|---|
@NonNull ActivityNavigator.Destination |
this |