NavType.EnumType


public final class NavType.EnumType<D extends Enum<@NonNull ?>> extends NavType.SerializableType


EnumType is used for NavArguments holding enum values.

Null values are not supported. To specify a default value in a Navigation XML file, simply use the enum constant without the class name, e.g. app:defaultValue="MONDAY".

Summary

Public constructors

<D extends Enum<@NonNull ?>> EnumType(@NonNull Class<@NonNull D> type)

Public methods

@NonNull String
@NonNull D

Parse a value of this type from a String.

Inherited methods

From androidx.navigation.NavType
boolean
@NonNull D
parseValue(@NonNull String value, @NonNull D previousValue)
@NonNull String
@NonNull String
boolean
valueEquals(@NonNull D value, @NonNull D other)
From androidx.navigation.NavType.SerializableType
boolean
equals(Object other)
D
get(@NonNull Bundle bundle, @NonNull String key)
int
void
put(@NonNull Bundle bundle, @NonNull String key, @NonNull D value)

Public constructors

EnumType

public <D extends Enum<@NonNull ?>> EnumType(@NonNull Class<@NonNull D> type)
Parameters
@NonNull Class<@NonNull D> type

the Enum class that is supported by this NavType

Public methods

getName

public @NonNull String getName()

parseValue

public @NonNullparseValue(@NonNull String value)

Parse a value of this type from a String.

Parameters
@NonNull String value

string representation of a value of this type

Returns
@NonNull D

parsed value of the type represented by this NavType

Throws
kotlin.IllegalArgumentException

if value cannot be parsed into this type