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 | |
---|---|
Destination(NavigatorProvider navigatorProvider)
Construct a new activity destination. |
|
Destination(Navigator<? extends ActivityNavigator.Destination> activityNavigator)
Construct a new activity destination. |
Public methods | |
---|---|
final
String
|
getAction()
Get the action used to start the Activity, if any |
final
ComponentName
|
getComponent()
Get the explicit |
final
Uri
|
getData()
Get the data URI used to start the Activity, if any |
final
String
|
getDataPattern()
Gets the dynamic data URI pattern, if any |
final
Intent
|
getIntent()
Gets the Intent associated with this destination. |
final
String
|
getTargetPackage()
Get the explicit application package name associated with this destination, if any |
void
|
onInflate(Context context, AttributeSet attrs)
Called when inflating a destination from a resource. |
final
ActivityNavigator.Destination
|
setAction(String action)
Sets the action sent when navigating to this destination. |
final
ActivityNavigator.Destination
|
setComponentName(ComponentName name)
Set an explicit |
final
ActivityNavigator.Destination
|
setData(Uri data)
Sets a static data URI that is sent when navigating to this destination. |
final
ActivityNavigator.Destination
|
setDataPattern(String dataPattern)
Sets a dynamic data URI pattern that is sent when navigating to this destination. |
final
ActivityNavigator.Destination
|
setIntent(Intent intent)
Set the Intent to start when navigating to this destination. |
final
ActivityNavigator.Destination
|
setTargetPackage(String packageName)
Set an explicit application package name that limits the components this destination will navigate to. |
String
|
toString()
|
Inherited methods | |
---|---|
Public constructors
Destination
public 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.
|
Destination
public 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 final String getAction ()
Get the action used to start the Activity, if any
Returns | |
---|---|
String |
getComponent
public final ComponentName getComponent ()
Get the explicit ComponentName
associated with this destination, if any
Returns | |
---|---|
ComponentName |
getDataPattern
public final String getDataPattern ()
Gets the dynamic data URI pattern, if any
Returns | |
---|---|
String |
getIntent
public final Intent getIntent ()
Gets the Intent associated with this destination.
Returns | |
---|---|
Intent |
getTargetPackage
public final String getTargetPackage ()
Get the explicit application package name associated with this destination, if any
Returns | |
---|---|
String |
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
|
setAction
public final 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 final 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 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 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
|
See also:
setDataPattern
public final 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 final 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
|
setTargetPackage
public final 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 | |
---|---|
packageName |
String : packageName to set |
Returns | |
---|---|
ActivityNavigator.Destination |
this ActivityNavigator.Destination
|
toString
public String toString ()
Returns | |
---|---|
String |