NavType
abstract class NavType<T : Any!>
kotlin.Any | |
↳ | androidx.navigation.NavType |
NavType denotes the type that can be used in a NavArgument
.
There are built-in NavTypes for primitive types, such as int, long, boolean, float, and strings, parcelable, and serializable classes (including Enums), as well as arrays of each supported type.
You should only use one of the static NavType instances and subclasses defined in this class.
Summary
Nested classes | |
---|---|
EnumType is used for |
|
ParcelableArrayType is used for |
|
ParcelableType is used for passing Parcelables in |
|
SerializableArrayType is used for |
|
open |
SerializableType is used for Serializable |
Public methods | |
---|---|
open static NavType<*> |
fromArgType(@Nullable : String?, @Nullable : String?) Parse an argType string into a NavType. |
abstract T? |
Get a value of this type from the |
abstract String |
getName() Returns the name of this type. |
open Boolean |
Check if an argument with this type can hold a null value. |
abstract T |
parseValue(@NonNull : String) Parse a value of this type from a String. |
abstract Unit |
Put a value of this type in he |
open String |
toString() |
Properties | |
---|---|
static NavType<BooleanArray!> |
NavType for storing boolean arrays, corresponding with the "boolean[]" type in a Navigation XML file. |
static NavType<Boolean!> |
NavType for storing boolean values, corresponding with the "boolean" type in a Navigation XML file. |
static NavType<FloatArray!> |
NavType for storing float arrays, corresponding with the "float[]" type in a Navigation XML file. |
static NavType<Float!> |
NavType for storing float values, corresponding with the "float" type in a Navigation XML file. |
static NavType<IntArray!> |
NavType for storing integer arrays, corresponding with the "integer[]" type in a Navigation XML file. |
static NavType<Int!> |
NavType for storing integer values, corresponding with the "integer" type in a Navigation XML file. |
static NavType<LongArray!> |
NavType for storing long arrays, corresponding with the "long[]" type in a Navigation XML file. |
static NavType<Long!> |
NavType for storing long values, corresponding with the "long" type in a Navigation XML file. |
static NavType<Int!> |
NavType for storing integer values representing resource ids, corresponding with the "reference" type in a Navigation XML file. |
static NavType<Array<String!>!> |
NavType for storing String arrays, corresponding with the "string[]" type in a Navigation XML file. |
static NavType<String!> |
NavType for storing String values, corresponding with the "string" type in a Navigation XML file. |
Public methods
fromArgType
@NonNull open static fun fromArgType(
@Nullable : String?,
@