NavType.EnumType

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

Object
   ↳ NavType
     ↳ NavType.SerializableType
       ↳ 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 fields

@NonNull String

The name of this type.

Public constructors

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

Public methods

@NonNull D

Parse a value of this type from a String.

Inherited methods

From class NavType
From class NavType.SerializableType
boolean
equals(Object other)
D
get(Bundle bundle, String key)

Get a value of this type from the bundle

int
void
put(Bundle bundle, String key, D value)

Put a value of this type in the bundle

Public fields

name

public @NonNull String name

The name of this type.

This is the same value that is used in Navigation XML argType attribute.

Returns
@NonNull String

name of this type

Public constructors

EnumType

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

the Enum class that is supported by this NavType

Public methods

parseValue

public @NonNullparseValue(String value)

Parse a value of this type from a String.

Parameters
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