TextSelection.Request.Builder


public final class TextSelection.Request.Builder


A builder for building TextSelection requests.

Summary

Public constructors

Builder(
    @NonNull CharSequence text,
    @IntRange(from = 0) int startIndex,
    @IntRange(from = 0) int endIndex
)

Public methods

@NonNull TextSelection.Request

Builds and returns the request object.

@NonNull TextSelection.Request.Builder
@NonNull TextSelection.Request.Builder

Sets the extended, vendor specific data.

Public constructors

Builder

public Builder(
    @NonNull CharSequence text,
    @IntRange(from = 0) int startIndex,
    @IntRange(from = 0) int endIndex
)
Parameters
@NonNull CharSequence text

text providing context for the selected text (which is specified by the sub sequence starting at selectionStartIndex and ending at selectionEndIndex)

@IntRange(from = 0) int startIndex

start index of the selected part of text

@IntRange(from = 0) int endIndex

end index of the selected part of text

Public methods

build

public @NonNull TextSelection.Request build()

Builds and returns the request object.

setDefaultLocales

public @NonNull TextSelection.Request.Builder setDefaultLocales(@Nullable LocaleListCompat defaultLocales)
Parameters
@Nullable LocaleListCompat defaultLocales

ordered list of locale preferences that may be used to disambiguate the provided text. If no locale preferences exist, set this to null or an empty locale list.

Returns
@NonNull TextSelection.Request.Builder

this builder.

setExtras

public @NonNull TextSelection.Request.Builder setExtras(@Nullable Bundle extras)

Sets the extended, vendor specific data.

Returns
@NonNull TextSelection.Request.Builder

this builder