# Parcelable.Creator

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Creator

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/os/Parcelable.Creator "View this page in Java")  

```
interface Creator<T : Any!>
```

|----------------------------------------------------------------------------------------------------------------|
| [android.os.Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator#) |

|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [Parcelable.ClassLoaderCreator](https://developer.android.com/reference/kotlin/android/os/Parcelable.ClassLoaderCreator) |--------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Parcelable.ClassLoaderCreator](https://developer.android.com/reference/kotlin/android/os/Parcelable.ClassLoaderCreator) | Specialization of[Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator#)that allows you to receive the ClassLoader the object is being created in. | |

Interface that must be implemented and provided as a public CREATOR field that generates instances of your Parcelable class from a Parcel.

## Summary

|                                                                                                                                                                                                                                                                                                 Public methods                                                                                                                                                                                                                                                                                                  ||
|----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstractT                                                                                    | [createFromParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator#createFromParcel(android.os.Parcel))`(`source:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel)!`)` Create a new instance of the Parcelable class, instantiating it from the given Parcel whose data had previously been written by[Parcelable.writeToParcel()](https://developer.android.com/reference/kotlin/android/os/Parcelable#writeToParcel(android.os.Parcel,%20kotlin.Int)). |
| abstract[Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<T\>! | [newArray](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator#newArray(kotlin.Int))`(`size:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Create a new array of the Parcelable class.                                                                                                                                                                                                                                                                 |

## Public methods

### createFromParcel

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun createFromParcel(source: Parcel!): T
```

Create a new instance of the Parcelable class, instantiating it from the given Parcel whose data had previously been written by[Parcelable.writeToParcel()](https://developer.android.com/reference/kotlin/android/os/Parcelable#writeToParcel(android.os.Parcel,%20kotlin.Int)).

|                                                            Parameters                                                            ||
|----------|------------------------------------------------------------------------------------------------------------------------|
| `source` | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel)!:The Parcel to read the object's data from. |

|                       Return                       ||
|---|-------------------------------------------------|
| T | Returns a new instance of the Parcelable class. |

### newArray

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun newArray(size: Int): Array<T>!
```

Create a new array of the Parcelable class.

|                                              Parameters                                               ||
|--------|-----------------------------------------------------------------------------------------------|
| `size` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Size of the array. |

|                                                                               Return                                                                                ||
|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<T>! | Returns an array of the Parcelable class, with every entry initialized to null. |