NavArgument
class NavArgument
kotlin.Any | |
↳ | androidx.navigation.NavArgument |
NavArgument denotes an argument that is supported by a NavDestination
.
A NavArgument has a type and optionally a default value, that are used to read/write it in a Bundle. It can also be nullable if the type supports it.
Summary
Nested classes | |
---|---|
A builder for constructing |
Public methods | |
---|---|
Boolean | |
Any? |
Returns the default value of this argument or `null` if it doesn't have a default value. |
NavType<*> |
getType() Get the type of this NavArgument. |
Int |
hashCode() |
Boolean |
This method can be used to distinguish between a default value of `null` and an argument without an explicit default value. |
Boolean |
Check if this argument allows passing a `null` value. |
Public methods
getDefaultValue
@Nullable fun getDefaultValue(): Any?
Returns the default value of this argument or `null` if it doesn't have a default value. Use isDefaultValuePresent()
to distinguish between `null` and absence of a value.
Return | |
---|---|
Any? |
The deafult value assigned to this argument. |
getType
@NonNull fun getType(): NavType<*>
Get the type of this NavArgument.
Return | |
---|---|
NavType<*> |
the NavType object denoting the type that can be help in this argument. |
hashCode
fun hashCode(): Int
isDefaultValuePresent
fun isDefaultValuePresent(): Boolean
This method can be used to distinguish between a default value of `null` and an argument without an explicit default value.
Return | |
---|---|
Boolean |
true if this argument has a default value (even if that value is set to null), false otherwise |