ContentCaptureContext.Builder


public static final class ContentCaptureContext.Builder
extends Object

java.lang.Object
   ↳ android.view.contentcapture.ContentCaptureContext.Builder


Builder for ContentCaptureContext objects.

Summary

Public constructors

Builder(LocusId id)

Creates a new builder.

Public methods

ContentCaptureContext build()

Builds the ContentCaptureContext.

ContentCaptureContext.Builder setExtras(Bundle extras)

Sets extra options associated with this context.

Inherited methods

Public constructors

Builder

Added in API level 29
public Builder (LocusId id)

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

build

Added in API level 29
public ContentCaptureContext build ()

Builds the ContentCaptureContext.

Returns
ContentCaptureContext the built ContentCaptureContext This value cannot be null.

Throws
IllegalStateException if build() was already called.

setExtras

Added in API level 29
public ContentCaptureContext.Builder setExtras (Bundle extras)

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.

Returns
ContentCaptureContext.Builder this builder. This value cannot be null.

Throws
IllegalStateException if build() was already called.