NavDeepLinkBuilder
class NavDeepLinkBuilder
kotlin.Any | |
↳ | androidx.navigation.NavDeepLinkBuilder |
Class used to construct deep links to a particular destination in a NavGraph
.
When this deep link is triggered:
- The task is cleared.
- The destination and all of its parents will be on the back stack.
- Calling
NavController#navigateUp()
will navigate to the parent of the destination.
start destination
of the containing navigation graph
. In the cases where the destination is the start destination of its containing navigation graph, the start destination of its grandparent is used.
You can construct an instance directly with NavDeepLinkBuilder(Context)
or build one using an existing NavController
via NavController#createDeepLink()
.
Summary
Public constructors | |
---|---|
Construct a new NavDeepLinkBuilder. |
Public methods | |
---|---|
PendingIntent |
Construct a |
TaskStackBuilder |
Construct the full |
NavDeepLinkBuilder |
setArguments(@Nullable : Bundle?) Set optional arguments to send onto the destination |
NavDeepLinkBuilder |
setComponentName(@NonNull : Class<out Activity!>) Sets an explicit Activity to be started by the deep link created by this class. |
NavDeepLinkBuilder |
setComponentName(@NonNull : ComponentName) Sets an explicit Activity to be started by the deep link created by this class. |
NavDeepLinkBuilder |
setDestination(@IdRes : Int) Sets the destination id to deep link to. |
NavDeepLinkBuilder |
Sets the graph that contains the |
NavDeepLinkBuilder |
Sets the graph that contains the |
Public constructors
<init>
NavDeepLinkBuilder(@NonNull : Context)
Construct a new NavDeepLinkBuilder. If the context passed in here is not an Activity
, this method will use android.content.pm.PackageManager#getLaunchIntentForPackage(String)
as the default activity to launch, if available.
Parameters | |
---|---|
context |
Context: Context used to create deep links |
See Also
Public methods
createPendingIntent
@NonNull fun createPendingIntent(): PendingIntent
Construct a PendingIntent
to the deep link destination
.
This constructs the entire task stack
needed.
You must have #setGraph and set a destination
before calling this method.
Return | |
---|---|
PendingIntent |
a PendingIntent constructed with TaskStackBuilder#getPendingIntent(int, int) to deep link to the given destination |
createTaskStackBuilder
@NonNull fun createTaskStackBuilder(): TaskStackBuilder
Construct the full task stack
needed to deep link to the given destination.
You must have #setGraph and set a destination
before calling this method.
Return | |
---|---|
TaskStackBuilder |
a TaskStackBuilder which can be used to send the deep link or create a PendingIntent to deep link to the given destination. |
setArguments
@NonNull fun setArguments(@Nullable : Bundle?): NavDeepLinkBuilder
Set optional arguments to send onto the destination
Parameters | |
---|---|
args |
Bundle?: arguments to pass to the destination |
Return | |
---|---|
NavDeepLinkBuilder |
this object for chaining |
setComponentName
@NonNull fun setComponentName(@NonNull : Class<out Activity!>): NavDeepLinkBuilder
Sets an explicit Activity to be started by the deep link created by this class.
Parameters | |
---|---|
activityClass |
Class<out Activity!>: The Activity to start. This Activity should have a NavController which uses the same NavGraph used to construct this deep link. |
Return | |
---|---|
NavDeepLinkBuilder |
this object for chaining |
setComponentName
@NonNull fun setComponentName(@NonNull : ComponentName): NavDeepLinkBuilder
Sets an explicit Activity to be started by the deep link created by this class.
Parameters | |
---|---|
componentName |
ComponentName: The Activity to start. This Activity should have a NavController which uses the same NavGraph used to construct this deep link. |
Return | |
---|---|
NavDeepLinkBuilder |
this object for chaining |
setDestination
@NonNull fun setDestination(@IdRes : Int): NavDeepLinkBuilder
Sets the destination id to deep link to.
Parameters | |
---|---|
destId |
Int: destination ID to deep link to. |