The Android Developer Challenge is back! Submit your idea before December 2.

NavType.EnumType

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

java.lang.Object
   ↳ androidx.navigation.NavType<D extends java.io.Serializable>
     ↳ androidx.navigation.NavType.SerializableType<D extends java.lang.Enum>
       ↳ androidx.navigation.NavType.EnumType<D extends java.lang.Enum>


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

Inherited fields

Public constructors

NavType.EnumType(Class<D> type)

Constructs a NavType that supports a given Enum type.

Public methods

String getName()

Returns the name of this type.

D parseValue(String value)

Parse a value of this type from a String.

Inherited methods

Public constructors

public NavType.EnumType (Class<D> type)

Constructs a NavType that supports a given Enum type.

Parameters
type Class: class that is an Enum

Public methods

getName

public String getName ()

Returns the name of this type.

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

Returns
String name of this type

parseValue

public D parseValue (String value)

Parse a value of this type from a String.

Parameters
value String: string representation of a value of this type

Returns
D parsed value of the type represented by this NavType