Stay organized with collections
Save and categorize content based on your preferences.
Annotation
open class Annotation : ParcelableSpan
Annotations are simple key-value pairs that are preserved across TextView save/restore cycles and can be used to keep application-specific data that needs to be maintained for regions of text.
Summary
Public constructors
Annotation
Annotation(src: Parcel!)
Public methods
describeContents
open fun describeContents(): Int
getKey
open fun getKey(): String!
getSpanTypeId
open fun getSpanTypeId(): Int
getValue
open fun getValue(): String!
writeToParcel
open fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
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,["# Annotation\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nAnnotation\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/Annotation \"View this page in Java\") \n\n```\nopen class Annotation : ParcelableSpan\n```\n\n|---|------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.text.Annotation](#) |\n\nAnnotations are simple key-value pairs that are preserved across TextView save/restore cycles and can be used to keep application-specific data that needs to be maintained for regions of text.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Annotation](#Annotation(android.os.Parcel))`(`src:` `[Parcel](../os/Parcel.html#)!`)` \u003cbr /\u003e |\n| [Annotation](#Annotation(kotlin.String,%20kotlin.String))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `value:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` \u003cbr /\u003e |\n\n| Public methods ||\n|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [describeContents](#describeContents())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getKey](#getKey())`()` \u003cbr /\u003e |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getSpanTypeId](#getSpanTypeId())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getValue](#getValue())`()` \u003cbr /\u003e |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [writeToParcel](#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`dest:` `[Parcel](../os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` \u003cbr /\u003e |\n\nPublic constructors\n-------------------\n\n### Annotation\n\nAdded in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nAnnotation(src: Parcel!)\n``` \n\n### Annotation\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nAnnotation(\n key: String!, \n value: String!)\n```\n\nPublic methods\n--------------\n\n### describeContents\n\nAdded in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun describeContents(): Int\n```\n\n| Return ||\n|----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or [android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR](../os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) |\n\n### getKey\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getKey(): String!\n``` \n\n### getSpanTypeId\n\nAdded in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getSpanTypeId(): Int\n``` \n\n### getValue\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getValue(): String!\n``` \n\n### writeToParcel\n\nAdded in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun writeToParcel(\n dest: Parcel, \n flags: Int\n): Unit\n```\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `dest` | [Parcel](../os/Parcel.html#): The Parcel in which the object should be written. This value cannot be `null`. |\n| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Additional flags about how the object should be written. May be 0 or [PARCELABLE_WRITE_RETURN_VALUE](../os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int). Value is either `0` or a combination of [android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE](../os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |"]]