# NavType.SerializableType

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavType.android.kt+class:androidx.navigation.NavType.SerializableType) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMJavaScript
- android

  ```
  open class NavType.SerializableType<D : Serializable> : NavType<D>
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.navigation.NavType](https://developer.android.com/reference/kotlin/androidx/navigation/NavType)\<D\> ||
|   | ↳ | [androidx.navigation.NavType.SerializableType](https://developer.android.com/reference/kotlin/androidx/navigation/NavType.SerializableType) |

Known direct subclasses [NavType.EnumType](https://developer.android.com/reference/kotlin/androidx/navigation/NavType.EnumType)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.EnumType` | EnumType is used for `https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument`s holding enum values. |

*** ** * ** ***

SerializableType is used for Serializable `https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument`s. For handling Enums you must use `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.EnumType` instead.

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.EnumType` |   |

## Summary

| ### Public constructors |
|---|---|
| `<D : https://developer.android.com/reference/java/io/Serializable.html> https://developer.android.com/reference/kotlin/androidx/navigation/NavType.SerializableType#SerializableType(java.lang.Class)(type: https://developer.android.com/reference/java/lang/Class.html<D>)` Constructs a NavType that supports a given Serializable type. | android |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.SerializableType#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | android |
| `open operator D?` | `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.SerializableType#get(android.os.Bundle,kotlin.String)(bundle: https://developer.android.com/reference/android/os/Bundle.html, key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Get a value of this type from the `savedState` | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.SerializableType#hashCode()()` | android |
| `open D` | `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.SerializableType#parseValue(kotlin.String)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.SerializableType#put(android.os.Bundle,kotlin.String,java.io.Serializable)(bundle: https://developer.android.com/reference/android/os/Bundle.html, key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, value: D)` Put a value of this type in the `savedState` | android |

| ### Public properties |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/navigation/NavType.SerializableType#name()` The name of this type. | android |

### Inherited functions

From [androidx.navigation.NavType](https://developer.android.com/reference/kotlin/androidx/navigation/NavType) `open D` `https://developer.android.com/reference/kotlin/androidx/navigation/NavType#parseValue(kotlin.String,kotlin.Any)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, previousValue: D)`

Parse a value of this type from a String and then combine that parsed value with the given previousValue of the same type to provide a new value that contains both the new and previous value.
android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/navigation/NavType#serializeAsValue(kotlin.Any)(value: D)`

Serialize a value of this NavType into a String.
android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/navigation/NavType#toString()()` android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/navigation/NavType#valueEquals(kotlin.Any,kotlin.Any)(value: D, other: D)`

Compares two values of type `https://developer.android.com/reference/kotlin/androidx/navigation/NavType` and returns true if values are equal.
android

### Inherited properties

From [androidx.navigation.NavType](https://developer.android.com/reference/kotlin/androidx/navigation/NavType) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/navigation/NavType#isNullableAllowed()`

Check if an argument with this type can hold a null value.
android

## Public constructors

### SerializableType

android

```
<D : Serializable> SerializableType(type: Class<D>)
```

Constructs a NavType that supports a given Serializable type.

| Parameters |
|---|---|
| `type: https://developer.android.com/reference/java/lang/Class.html<D>` | class that is a subtype of Serializable |

## Public functions

### equals

android

```
open operator fun equals(other: Any?): Boolean
```

### get

android

```
open operator fun get(bundle: Bundle, key: String): D?
```

Get a value of this type from the `savedState`

| Parameters |
|---|---|
| `bundle: https://developer.android.com/reference/android/os/Bundle.html` | savedState to get value from |
| `key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | savedState key |

| Returns |
|---|---|
| `D?` | value of this type |

### hashCode

android

```
open fun hashCode(): Int
```

### parseValue

android

```
open fun parseValue(value: String): D
```

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` | since Serializables do not support default values |

### put

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
open fun put(bundle: Bundle, key: String, value: D): Unit
```

Put a value of this type in the `savedState`

| Parameters |
|---|---|
| `bundle: https://developer.android.com/reference/android/os/Bundle.html` | savedState to put value in |
| `key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | savedState key |
| `value: D` | value of this type |

## Public properties

### name

android

```
open val name: String
```

The name of this type.

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

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | name of this type |