Stay organized with collections
Save and categorize content based on your preferences.
Parcelable.Creator
public
static
interface
Parcelable.Creator
android.os.Parcelable.Creator<T>
|
Known indirect subclasses
|
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
|
createFromParcel(Parcel source)
Create a new instance of the Parcelable class, instantiating it
from the given Parcel whose data had previously been written by
Parcelable.writeToParcel() .
|
abstract
T[]
|
newArray(int size)
Create a new array of the Parcelable class.
|
Public methods
createFromParcel
public abstract T createFromParcel (Parcel source)
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. |
Returns |
T |
Returns a new instance of the Parcelable class. |
newArray
public abstract T[] newArray (int size)
Create a new array of the Parcelable class.
Parameters |
size |
int : Size of the array. |
Returns |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Parcelable.Creator\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nParcelable.Creator\n==================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/os/Parcelable.Creator \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nParcelable.Creator\n`\n\n\n`\n\n\n`\n\n|------------------------------------|\n| android.os.Parcelable.Creator\\\u003cT\\\u003e |\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [Parcelable.ClassLoaderCreator](/reference/android/os/Parcelable.ClassLoaderCreator)\\\u003cT\\\u003e |-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| | [Parcelable.ClassLoaderCreator](/reference/android/os/Parcelable.ClassLoaderCreator)\\\u003cT\\\u003e | Specialization of [Creator](/reference/android/os/Parcelable.Creator) that allows you to receive the ClassLoader the object is being created in. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface that must be implemented and provided as a public CREATOR\nfield that generates instances of your Parcelable class from a Parcel.\n\nSummary\n-------\n\n| ### Public methods ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract T` | ` `[createFromParcel](/reference/android/os/Parcelable.Creator#createFromParcel(android.os.Parcel))`(`[Parcel](/reference/android/os/Parcel)` source) ` Create a new instance of the Parcelable class, instantiating it from the given Parcel whose data had previously been written by [Parcelable.writeToParcel()](/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)). |\n| ` abstract T[]` | ` `[newArray](/reference/android/os/Parcelable.Creator#newArray(int))`(int size) ` Create a new array of the Parcelable class. |\n\nPublic methods\n--------------\n\n### createFromParcel\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract T createFromParcel (Parcel source)\n```\n\nCreate a new instance of the Parcelable class, instantiating it\nfrom the given Parcel whose data had previously been written by\n[Parcelable.writeToParcel()](/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)).\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|-------------------------------------------------------------|\n| `source` | `Parcel`: The Parcel to read the object's data from. \u003cbr /\u003e |\n\n| Returns ||\n|-----|--------------------------------------------------------|\n| `T` | Returns a new instance of the Parcelable class. \u003cbr /\u003e |\n\n### newArray\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract T[] newArray (int size)\n```\n\nCreate a new array of the Parcelable class.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|----------------------------------|\n| `size` | `int`: Size of the array. \u003cbr /\u003e |\n\n| Returns ||\n|-------|----------------------------------------------------------------------------------------|\n| `T[]` | Returns an array of the Parcelable class, with every entry initialized to null. \u003cbr /\u003e |"]]