Stay organized with collections
Save and categorize content based on your preferences.
ClassLoaderCreator
interface ClassLoaderCreator<T : Any!> : Parcelable.Creator<T>
Specialization of Creator
that allows you to receive the ClassLoader the object is being created in.
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() and using the given ClassLoader.
|
Public methods
createFromParcel
abstract fun createFromParcel(
source: Parcel!,
loader: ClassLoader!
): T
Create a new instance of the Parcelable class, instantiating it from the given Parcel whose data had previously been written by Parcelable.writeToParcel()
and using the given ClassLoader.
Parameters |
source |
Parcel!: The Parcel to read the object's data from. |
loader |
ClassLoader!: The ClassLoader that this object is being created in. |
Return |
T |
Returns a new instance of the Parcelable class. |
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.ClassLoaderCreator\n\nAdded in [API level 13](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nClassLoaderCreator\n==================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/os/Parcelable.ClassLoaderCreator \"View this page in Java\") \n\n```\ninterface ClassLoaderCreator\u003cT : Any!\u003e : Parcelable.Creator\u003cT\u003e\n```\n\n|-----------------------------------------------|\n| [android.os.Parcelable.ClassLoaderCreator](#) |\n\nSpecialization of [Creator](/reference/kotlin/android/os/Parcelable.Creator) that allows you to receive the ClassLoader the object is being created in.\n\nSummary\n-------\n\n| Public methods ||\n|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract T | [createFromParcel](#createFromParcel(android.os.Parcel,%20java.lang.ClassLoader))`(`source:` `[Parcel](/reference/kotlin/android/os/Parcel)!`, `loader:` `[ClassLoader](../../java/lang/ClassLoader.html#)!`)` 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)) and using the given ClassLoader. |\n\n| Inherited functions ||\n|---|---|\n| From class [Creator](/reference/kotlin/android/os/Parcelable.Creator) |------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | T | [createFromParcel](/reference/kotlin/android/os/Parcelable.Creator#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)). \u003cbr /\u003e | | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\u003cT\u003e! | [newArray](/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. \u003cbr /\u003e | ||\n\nPublic methods\n--------------\n\n### createFromParcel\n\nAdded in [API level 13](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun createFromParcel(\n source: Parcel!, \n loader: ClassLoader!\n): 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)) and using the given ClassLoader.\n\n| Parameters ||\n|----------|----------------------------------------------------------------------------------------------------------|\n| `source` | [Parcel](/reference/kotlin/android/os/Parcel)!: The Parcel to read the object's data from. |\n| `loader` | [ClassLoader](../../java/lang/ClassLoader.html#)!: The ClassLoader that this object is being created in. |\n\n| Return ||\n|---|-------------------------------------------------|\n| T | Returns a new instance of the Parcelable class. |"]]