NavDestinationBuilder
open class NavDestinationBuilder<out D : NavDestination>
kotlin.Any | |
↳ | androidx.navigation.NavDestinationBuilder |
DSL for constructing a new NavDestination
Summary
Public constructors | |
---|---|
DSL for constructing a new NavDestination |
Public methods | |
---|---|
Unit |
action(: Int, : NavActionBuilder.() -> Unit) Adds a new NavAction to the destination |
Unit |
argument(: String, : NavArgumentBuilder.() -> Unit) Add a NavArgument to this destination. |
open D |
build() Build the NavDestination by calling Navigator.createDestination. |
Unit |
Add a deep link to this destination. |
Unit |
deepLink(: NavDeepLinkDslBuilder.() -> Unit) Add a deep link to this destination. |
Properties | |
---|---|
Int | |
CharSequence? |
The descriptive label of the destination |
Navigator<out D> |
Public constructors
<init>
NavDestinationBuilder(
: Navigator<out D>,
@IdRes : Int)
DSL for constructing a new NavDestination
Public methods
action
fun action(
: Int,
: NavActionBuilder.() -> Unit
): Unit
Adds a new NavAction to the destination
argument
fun argument(
: String,
: NavArgumentBuilder.() -> Unit
): Unit
Add a NavArgument to this destination.
deepLink
fun deepLink(: String): Unit
Add a deep link to this destination.
In addition to a direct Uri match, the following features are supported:
- Uris without a scheme are assumed as http and https. For example,
www.example.com
will matchhttp://www.example.com
andhttps://www.example.com
. - Placeholders in the form of
{placeholder_name}
matches 1 or more characters. The String value of the placeholder will be available in the arguments Bundle with a key of the same name. For example,http://www.example.com/users/{id}
will matchhttp://www.example.com/users/4
. - The
.*
wildcard can be used to match 0 or more characters.
Parameters | |
---|---|
: String | The uri pattern to add as a deep link |
See Also
deepLink
fun deepLink(: NavDeepLinkDslBuilder.() -> Unit): Unit
Add a deep link to this destination.
In addition to a direct Uri match, the following features are supported:
- Uris without a scheme are assumed as http and https. For example,
www.example.com
will matchhttp://www.example.com
andhttps://www.example.com
. - Placeholders in the form of
{placeholder_name}
matches 1 or more characters. The String value of the placeholder will be available in the arguments Bundle with a key of the same name. For example,http://www.example.com/users/{id}
will matchhttp://www.example.com/users/4
. - The
.*
wildcard can be used to match 0 or more characters.
Parameters | |
---|---|
: NavDeepLinkDslBuilder.() -> Unit | the NavDeepLink to be added to this destination |
Properties
id
val id: Int
navigator
protected val navigator: Navigator<out D>