Stay organized with collections
Save and categorize content based on your preferences.
Creator
interface Creator<T : Any!>
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 |
abstract T |
Create a new instance of the Parcelable class, instantiating it from the given Parcel whose data had previously been written by Parcelable.writeToParcel() .
|
abstract Array<T>! |
Create a new array of the Parcelable class.
|
Public methods
createFromParcel
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()
.
Parameters |
source |
Parcel!: The Parcel to read the object's data from. |
Return |
T |
Returns a new instance of the Parcelable class. |
newArray
abstract fun newArray(size: Int): Array<T>!
Create a new array of the Parcelable class.
Parameters |
size |
Int: Size of the array. |
Return |
Array<T>! |
Returns an array of the Parcelable class, with every entry initialized to null. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Parcelable.Creator\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nCreator\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/os/Parcelable.Creator \"View this page in Java\") \n\n```\ninterface Creator\u003cT : Any!\u003e\n```\n\n|------------------------------------|\n| [android.os.Parcelable.Creator](#) |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [Parcelable.ClassLoaderCreator](/reference/kotlin/android/os/Parcelable.ClassLoaderCreator) |---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------| | [Parcelable.ClassLoaderCreator](/reference/kotlin/android/os/Parcelable.ClassLoaderCreator) | Specialization of [Creator](#) that allows you to receive the ClassLoader the object is being created in. | |\n\nInterface that must be implemented and provided as a public CREATOR field that generates instances of your Parcelable class from a Parcel.\n\nSummary\n-------\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract T | [createFromParcel](#createFromParcel(android.os.Parcel))`(`source:` `[Parcel](/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()](/reference/kotlin/android/os/Parcelable#writeToParcel(android.os.Parcel,%20kotlin.Int)). |\n| abstract [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\\\u003cT\\\u003e! | [newArray](#newArray(kotlin.Int))`(`size:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Create a new array of the Parcelable class. |\n\nPublic methods\n--------------\n\n### createFromParcel\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun createFromParcel(source: Parcel!): T\n```\n\nCreate a new instance of the Parcelable class, instantiating it from the given Parcel whose data had previously been written by [Parcelable.writeToParcel()](/reference/kotlin/android/os/Parcelable#writeToParcel(android.os.Parcel,%20kotlin.Int)).\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------------------|\n| `source` | [Parcel](/reference/kotlin/android/os/Parcel)!: The Parcel to read the object's data from. |\n\n| Return ||\n|---|-------------------------------------------------|\n| T | Returns a new instance of the Parcelable class. |\n\n### newArray\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun newArray(size: Int): Array\u003cT\u003e!\n```\n\nCreate a new array of the Parcelable class.\n\n| Parameters ||\n|--------|------------------------------------------------------------------------------------------------|\n| `size` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Size of the array. |\n\n| Return ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\u003cT\u003e! | Returns an array of the Parcelable class, with every entry initialized to null. |"]]