Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

EnumType

class EnumType<D : Enum<Enum<*>>!> : NavType.SerializableType<D>
kotlin.Any
   ↳ androidx.navigation.NavType<D>
   ↳ androidx.navigation.NavType.SerializableType<D>
   ↳ androidx.navigation.NavType.EnumType

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

<init>(@NonNull type: Class<D>)

Constructs a NavType that supports a given Enum type.

Public methods

String

D
parseValue(@NonNull value: String)

Inherited functions

Inherited properties

Public constructors

<init>

EnumType(@NonNull type: Class<D>)

Constructs a NavType that supports a given Enum type.

Parameters
type Class<D>: class that is an Enum

Public methods

getName

@NonNull fun getName(): String

parseValue

@NonNull fun parseValue(@NonNull value: String): D