Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
A builder for a ClipData Item.
Summary
Public constructors
Public methods
build
fun build(): ClipData.Item
Constructs a new Item with the properties set on this builder.
setHtmlText
fun setHtmlText(htmlText: String?): ClipData.Item.Builder
Sets the HTML text for the item to be constructed.
Parameters |
htmlText |
String?: This value may be null . |
setIntentSender
fun setIntentSender(intentSender: IntentSender?): ClipData.Item.Builder
Sets the IntentSender
for the item to be constructed. To prevent receiving apps from improperly manipulating the intent to launch another activity as this caller, the provided IntentSender must be immutable. If there is a fixed lifetime for this ClipData (ie. for drag and drop), the system will cancel the IntentSender when it is no longer used.
Parameters |
intentSender |
IntentSender?: This value may be null . |
setUri
fun setUri(uri: Uri?): ClipData.Item.Builder
Sets the URI for the item to be constructed.
Parameters |
uri |
Uri?: This value may be null . |
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,["# ClipData.Item.Builder\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/content/ClipData.Item.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|--------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.content.ClipData.Item.Builder](#) |\n\nA builder for a ClipData Item.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [ClipData.Item](/reference/kotlin/android/content/ClipData.Item) | [build](#build())`()` Constructs a new Item with the properties set on this builder. |\n| [ClipData.Item.Builder](#) | [setHtmlText](#setHtmlText(kotlin.String))`(`htmlText:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Sets the HTML text for the item to be constructed. |\n| [ClipData.Item.Builder](#) | [setIntent](#setIntent(android.content.Intent))`(`intent:` `[Intent](/reference/kotlin/android/content/Intent)?`)` Sets the Intent for the item to be constructed. |\n| [ClipData.Item.Builder](#) | [setIntentSender](#setIntentSender(android.content.IntentSender))`(`intentSender:` `[IntentSender](/reference/kotlin/android/content/IntentSender)?`)` Sets the [IntentSender](/reference/kotlin/android/content/IntentSender) for the item to be constructed. |\n| [ClipData.Item.Builder](#) | [setText](#setText(kotlin.CharSequence))`(`text:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?`)` Sets the text for the item to be constructed. |\n| [ClipData.Item.Builder](#) | [setUri](#setUri(android.net.Uri))`(`uri:` `[Uri](../net/Uri.html#)?`)` Sets the URI for the item to be constructed. |\n\nPublic constructors\n-------------------\n\n### Builder\n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): ClipData.Item\n```\n\nConstructs a new Item with the properties set on this builder.\n\n| Return ||\n|------------------------------------------------------------------|------------------------------|\n| [ClipData.Item](/reference/kotlin/android/content/ClipData.Item) | This value cannot be `null`. |\n\n### setHtmlText\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setHtmlText(htmlText: String?): ClipData.Item.Builder\n```\n\nSets the HTML text for the item to be constructed.\n\n| Parameters ||\n|------------|--------------------------------------------------------------------------------------------------------------|\n| `htmlText` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: This value may be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [ClipData.Item.Builder](#) | This value cannot be `null`. |\n\n### setIntent\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setIntent(intent: Intent?): ClipData.Item.Builder\n```\n\nSets the Intent for the item to be constructed.\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------|\n| `intent` | [Intent](/reference/kotlin/android/content/Intent)?: This value may be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [ClipData.Item.Builder](#) | This value cannot be `null`. |\n\n### setIntentSender\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setIntentSender(intentSender: IntentSender?): ClipData.Item.Builder\n```\n\nSets the [IntentSender](/reference/kotlin/android/content/IntentSender) for the item to be constructed. To prevent receiving apps from improperly manipulating the intent to launch another activity as this caller, the provided IntentSender must be immutable. If there is a fixed lifetime for this ClipData (ie. for drag and drop), the system will cancel the IntentSender when it is no longer used.\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------------------|\n| `intentSender` | [IntentSender](/reference/kotlin/android/content/IntentSender)?: This value may be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [ClipData.Item.Builder](#) | This value cannot be `null`. |\n\n### setText\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setText(text: CharSequence?): ClipData.Item.Builder\n```\n\nSets the text for the item to be constructed.\n\n| Parameters ||\n|--------|---------------------------------------------------------------------------------------------------------------------------|\n| `text` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)?: This value may be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [ClipData.Item.Builder](#) | This value cannot be `null`. |\n\n### setUri\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setUri(uri: Uri?): ClipData.Item.Builder\n```\n\nSets the URI for the item to be constructed.\n\n| Parameters ||\n|-------|-----------------------------------------------------|\n| `uri` | [Uri](../net/Uri.html#)?: This value may be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [ClipData.Item.Builder](#) | This value cannot be `null`. |"]]