Stay organized with collections
Save and categorize content based on your preferences.
OnPrimaryClipChangedListener
interface OnPrimaryClipChangedListener
Defines a listener callback that is invoked when the primary clip on the clipboard changes. Objects that want to register a listener call addPrimaryClipChangedListener()
with an object that implements OnPrimaryClipChangedListener.
Summary
Public methods
onPrimaryClipChanged
abstract fun onPrimaryClipChanged(): Unit
Callback that is invoked by android.content.ClipboardManager
when the primary clip changes.
This is called when the result of ClipDescription.getClassificationStatus()
changes, as well as when new clip data is set. So in cases where text classification is performed, this callback may be invoked multiple times for the same clip.
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,["# ClipboardManager.OnPrimaryClipChangedListener\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnPrimaryClipChangedListener\n============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/content/ClipboardManager.OnPrimaryClipChangedListener \"View this page in Java\") \n\n```\ninterface OnPrimaryClipChangedListener\n```\n\n|--------------------------------------------------------------------|\n| [android.content.ClipboardManager.OnPrimaryClipChangedListener](#) |\n\nDefines a listener callback that is invoked when the primary clip on the clipboard changes. Objects that want to register a listener call [addPrimaryClipChangedListener()](/reference/kotlin/android/content/ClipboardManager#addPrimaryClipChangedListener(android.content.ClipboardManager.OnPrimaryClipChangedListener)) with an object that implements OnPrimaryClipChangedListener.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onPrimaryClipChanged](#onPrimaryClipChanged())`()` Callback that is invoked by [android.content.ClipboardManager](/reference/kotlin/android/content/ClipboardManager) when the primary clip changes. |\n\nPublic methods\n--------------\n\n### onPrimaryClipChanged\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onPrimaryClipChanged(): Unit\n```\n\nCallback that is invoked by [android.content.ClipboardManager](/reference/kotlin/android/content/ClipboardManager) when the primary clip changes.\n\nThis is called when the result of [ClipDescription.getClassificationStatus()](/reference/kotlin/android/content/ClipDescription#getClassificationStatus()) changes, as well as when new clip data is set. So in cases where text classification is performed, this callback may be invoked multiple times for the same clip."]]