Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder for ContentCaptureContext
objects.
Summary
Public constructors |
Creates a new builder.
|
Public constructors
Builder
Builder(id: LocusId)
Creates a new builder.
The context must have an id, which is usually one of the following:
- A URL representing a web page (or
IFRAME
) that's being rendered by the activity (See View.setContentCaptureSession(ContentCaptureSession)
for an example).
- A unique identifier of the application state (for example, a conversation between 2 users in a chat app).
See ContentCaptureManager
for more info about the content capture context.
Parameters |
id |
LocusId: id associated with this context. This value cannot be null . |
Public methods
fun setExtras(extras: Bundle): ContentCaptureContext.Builder
Sets extra options associated with this context.
It can be used to provide vendor-specific data that can be modified and examined.
Parameters |
extras |
Bundle: extra options. This value cannot be null . |
Exceptions |
java.lang.IllegalStateException |
if build() was already called. |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ContentCaptureContext.Builder\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/contentcapture/ContentCaptureContext.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.view.contentcapture.ContentCaptureContext.Builder](#) |\n\nBuilder for [ContentCaptureContext](/reference/kotlin/android/view/contentcapture/ContentCaptureContext) objects.\n\nSummary\n-------\n\n| Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(android.content.LocusId))`(`id:` `[LocusId](../../content/LocusId.html#)`)` Creates a new builder. |\n\n| Public methods ||\n|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| [ContentCaptureContext](/reference/kotlin/android/view/contentcapture/ContentCaptureContext) | [build](#build())`()` Builds the [ContentCaptureContext](/reference/kotlin/android/view/contentcapture/ContentCaptureContext). |\n| [ContentCaptureContext.Builder](#) | [setExtras](#setExtras(android.os.Bundle))`(`extras:` `[Bundle](../../os/Bundle.html#)`)` Sets extra options associated with this context. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder(id: LocusId)\n```\n\nCreates a new builder.\n\nThe context must have an id, which is usually one of the following:\n\n- A URL representing a web page (or `IFRAME`) that's being rendered by the activity (See [View.setContentCaptureSession(ContentCaptureSession)](../View.html#setContentCaptureSession(android.view.contentcapture.ContentCaptureSession)) for an example).\n- A unique identifier of the application state (for example, a conversation between 2 users in a chat app).\n\nSee [ContentCaptureManager](/reference/kotlin/android/view/contentcapture/ContentCaptureManager) for more info about the content capture context.\n\n| Parameters ||\n|------|-------------------------------------------------------------------------------------------------------|\n| `id` | [LocusId](../../content/LocusId.html#): id associated with this context. This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): ContentCaptureContext\n```\n\nBuilds the [ContentCaptureContext](/reference/kotlin/android/view/contentcapture/ContentCaptureContext).\n\n| Return ||\n|----------------------------------------------------------------------------------------------|----------------------------------------------------------------|\n| [ContentCaptureContext](/reference/kotlin/android/view/contentcapture/ContentCaptureContext) | the built `ContentCaptureContext` This value cannot be `null`. |\n\n| Exceptions ||\n|-----------------------------------|--------------------------------------------|\n| `java.lang.IllegalStateException` | if [build()](#build()) was already called. |\n\n### setExtras\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setExtras(extras: Bundle): ContentCaptureContext.Builder\n```\n\nSets extra options associated with this context.\n\nIt can be used to provide vendor-specific data that can be modified and examined.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------|\n| `extras` | [Bundle](../../os/Bundle.html#): extra options. This value cannot be `null`. |\n\n| Return ||\n|------------------------------------|--------------------------------------------|\n| [ContentCaptureContext.Builder](#) | this builder. This value cannot be `null`. |\n\n| Exceptions ||\n|-----------------------------------|--------------------------------------------|\n| `java.lang.IllegalStateException` | if [build()](#build()) was already called. |"]]