Class

ClipEntry

Android specific class that contains the primary clip in android.content.ClipboardManager.

Source set: Android
public class ClipEntry(public val clipData: ClipData)

Android specific class that contains the primary clip in android.content.ClipboardManager.

Properties

clipMetadata

Source set: Android
public val clipMetadata: ClipMetadata = clipData.description.toClipMetadata()

Functions

readText

Source set: Android
public actual suspend fun readText(): String?

readPlainText

Source set: Android
public actual suspend fun readPlainText(): String?

readHtml

Source set: Android
public actual suspend fun readHtml(): String?

readUrl

Source set: Android
public actual suspend fun readUrl(): String?

Members

Companion

Source set: Android
public actual companion object

Functions

withText

Source set: Android
public fun withText(plainText: String, html: String?): ClipEntry

withUrl

Source set: Android
public fun withUrl(
            url: String,
            plainText: String,
            html: String?,
        ): ClipEntry
Source set: Common
public class ClipEntry

Platform specific protocol that expresses an item in the native Clipboard.

Properties

clipMetadata

Source set: Common
public val clipMetadata: ClipMetadata

Returns a ClipMetadata which describes the contents of this ClipEntry. This is an ideal way to check whether to accept or reject what may be pasted from the clipboard without explicitly reading the content.

Calling this function does not trigger any content access warnings on any platform.

Functions

readText

Source set: Common
public suspend fun readText(): String?

Reads the first available text representation of this clip.

Use readText() when you want the best-effort text value from a clip: it prefers plain text, then falls back to HTML or a URL. Use readPlainText, readHtml, or readUrl to request a specific representation.

Return

plain text, HTML markup, or URL text, or null if none can be read

readPlainText

Source set: Common
public suspend fun readPlainText(): String?

Reads the plain-text representation.

Unlike readText, returns null when plain text is unavailable instead of trying other representations.

Use readPlainText() when the caller accepts only plain text and should get null rather than HTML or a URL if plain text is unavailable.

Return

plain text, or null if unavailable or reading fails

readHtml

Source set: Common
public suspend fun readHtml(): String?

Reads the HTML representation. If there is no HTML representation available, this method doesn't try to read other text values.

Return

HTML markup, or null if unavailable or reading fails

readUrl

Source set: Common
public suspend fun readUrl(): String?

Reads the URL representation. If there is no URL representation available, this method doesn't try to read other text values.

Return

URL string, or null if unavailable or reading fails

Members

Companion

Source set: Common
public companion object

Functions

withText

Source set: Common
public fun withText(plainText: String, html: String? = null): ClipEntry

Creates an entry with plainText and optional html representations.

Parameters

plainText plain-text representation of the item
html optional HTML representation of the same text content

withUrl

Source set: Common
public fun withUrl(url: String, plainText: String = url, html: String? = null): ClipEntry

Creates an entry with URL, plain-text and optional HTML representation.

Parameters

url valid URL string to write; this function does not validate url
plainText plain-text fallback, such as a label; defaults to url
html optional HTML link for the same URL
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: