{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ClipboardManager


Interface for managing the Clipboard.

Summary

Public functions

AnnotatedString?

This method get the text from the Clipboard.

Cmn
open Boolean

This method returns true if there is a text in the Clipboard, false otherwise.

Cmn
Unit
setText(annotatedString: AnnotatedString)

This method put the text into the Clipboard.

Cmn

Public functions

getText

fun getText(): AnnotatedString?

This method get the text from the Clipboard.

Returns
AnnotatedString?

The text in the Clipboard. It could be null due to 2 reasons: 1. Clipboard is empty; 2. Cannot convert the CharSequence text in Clipboard to AnnotatedString.

hasText

open fun hasText(): Boolean

This method returns true if there is a text in the Clipboard, false otherwise.

setText

fun setText(annotatedString: AnnotatedString): Unit

This method put the text into the Clipboard.

Parameters
annotatedString: AnnotatedString

The AnnotatedString to be put into Clipboard.