NavType.SerializableType

public static class NavType.SerializableType
extends NavType<D extends Serializable>

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


SerializableType is used for Serializable NavArguments. For handling Enums you must use NavType.EnumType instead.

Null values are supported. Default values in Navigation XML files are not supported.

See also:

Summary

Inherited fields

Public constructors

NavType.SerializableType(Class<D> type)

Constructs a NavType that supports a given Serializable type.

Public methods

boolean equals(Object o)
D get(Bundle bundle, String key)

Get a value of this type from the bundle

String getName()

Returns the name of this type.

int hashCode()
D parseValue(String value)

Parse a value of this type from a String.

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

Put a value of this type in he bundle

Inherited methods

Public constructors

public NavType.SerializableType (Class<D> type)

Constructs a NavType that supports a given Serializable type.

Parameters
type Class: class that is a subtype of Serializable

Public methods

equals

public boolean equals (Object o)

Parameters
o Object

Returns
boolean

get

public D get (Bundle bundle,
                String key)

Get a value of this type from the bundle

Parameters
bundle Bundle: bundle to get value from

key String: bundle key

Returns
D value of this type

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

hashCode

public int hashCode ()

Returns
int

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

put

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

Put a value of this type in he bundle

Parameters
bundle Bundle: bundle to put value in

key String: bundle key

value D: value of this type