Stay organized with collections
Save and categorize content based on your preferences.
ClipboardManager
abstract class ClipboardManager
Known Direct Subclasses
ClipboardManager |
Interface to the clipboard service, for placing and retrieving text in the global clipboard.
|
|
Summary
Public methods |
abstract CharSequence! |
Returns the text on the clipboard.
|
abstract Boolean |
Returns true if the clipboard contains text; false otherwise.
|
abstract Unit |
Sets the contents of the clipboard to the specified text.
|
Public constructors
ClipboardManager
ClipboardManager()
Public methods
getText
abstract fun getText(): CharSequence!
Deprecated: Deprecated in Java.
Returns the text on the clipboard. It will eventually be possible to store types other than text too, in which case this will return null if the type cannot be coerced to text.
hasText
abstract fun hasText(): Boolean
Deprecated: Deprecated in Java.
Returns true if the clipboard contains text; false otherwise.
setText
abstract fun setText(text: CharSequence!): Unit
Deprecated: Deprecated in Java.
Sets the contents of the clipboard to the specified text.
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,["# ClipboardManager\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nClipboardManager\n================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/text/ClipboardManager \"View this page in Java\") \n\n```\nabstract class ClipboardManager\n```\n\n|---|------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.text.ClipboardManager](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [ClipboardManager](../content/ClipboardManager.html#) |-------------------------------------------------------|----------------------------------------------------------------------------------------------| | [ClipboardManager](../content/ClipboardManager.html#) | Interface to the clipboard service, for placing and retrieving text in the global clipboard. | |\n\n*** ** * ** ***\n\n| **This class was deprecated in API level 11.**\n|\n| Old text-only interface to the clipboard. See [android.content.ClipboardManager](../content/ClipboardManager.html#) for the modern API.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------|---|\n| [ClipboardManager](#ClipboardManager())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)! | [getText](#getText())`()` Returns the text on the clipboard. |\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [hasText](#hasText())`()` Returns true if the clipboard contains text; false otherwise. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [setText](#setText(kotlin.CharSequence))`(`text:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`)` Sets the contents of the clipboard to the specified text. |\n\nPublic constructors\n-------------------\n\n### ClipboardManager\n\n```\nClipboardManager()\n```\n\nPublic methods\n--------------\n\n### getText\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getText(): CharSequence!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nReturns the text on the clipboard. It will eventually be possible to store types other than text too, in which case this will return null if the type cannot be coerced to text. \n\n### hasText\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun hasText(): Boolean\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nReturns true if the clipboard contains text; false otherwise. \n\n### setText\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun setText(text: CharSequence!): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nSets the contents of the clipboard to the specified text."]]