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

ClipboardManager

public interface ClipboardManager


Interface for managing the Clipboard.

Summary

Public methods

abstract AnnotatedString

This method get the text from the Clipboard.

default boolean

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

abstract void
setText(@NonNull AnnotatedString annotatedString)

This method put the text into the Clipboard.

Public methods

getText

abstract AnnotatedString getText()

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

default boolean hasText()

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

setText

abstract void setText(@NonNull AnnotatedString annotatedString)

This method put the text into the Clipboard.

Parameters
@NonNull AnnotatedString annotatedString

The AnnotatedString to be put into Clipboard.