Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
A builder for building TextClassification requests.
Summary
Public constructors
Builder
Builder(
text: CharSequence,
startIndex: Int,
endIndex: Int)
Parameters |
text |
CharSequence: text providing context for the text to classify (which is specified by the sub sequence starting at startIndex and ending at endIndex) This value cannot be null . |
startIndex |
Int: start index of the text to classify Value is 0 or greater |
endIndex |
Int: end index of the text to classify Value is 0 or greater |
Public methods
setDefaultLocales
fun setDefaultLocales(defaultLocales: LocaleList?): TextClassification.Request.Builder
Parameters |
defaultLocales |
LocaleList?: 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. |
setReferenceTime
fun setReferenceTime(referenceTime: ZonedDateTime?): TextClassification.Request.Builder
Parameters |
referenceTime |
ZonedDateTime?: reference time based on which relative dates (e.g. "tomorrow" should be interpreted. This should usually be the time when the text was originally composed. If no reference time is set, now is used. 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.
[[["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,["# TextClassification.Request.Builder\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/textclassifier/TextClassification.Request.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.textclassifier.TextClassification.Request.Builder](#) |\n\nA builder for building TextClassification requests.\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Builder](#Builder(kotlin.CharSequence,%20kotlin.Int,%20kotlin.Int))`(`text:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)`, `startIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `endIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` \u003cbr /\u003e |\n\n| Public methods ||\n|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [TextClassification.Request](/reference/kotlin/android/view/textclassifier/TextClassification.Request) | [build](#build())`()` Builds and returns the request object. |\n| [TextClassification.Request.Builder](#) | [setDefaultLocales](#setDefaultLocales(android.os.LocaleList))`(`defaultLocales:` `[LocaleList](../../os/LocaleList.html#)?`)` \u003cbr /\u003e |\n| [TextClassification.Request.Builder](#) | [setExtras](#setExtras(android.os.Bundle))`(`extras:` `[Bundle](../../os/Bundle.html#)?`)` Sets the extended data. |\n| [TextClassification.Request.Builder](#) | [setReferenceTime](#setReferenceTime(java.time.ZonedDateTime))`(`referenceTime:` `[ZonedDateTime](../../../java/time/ZonedDateTime.html#)?`)` \u003cbr /\u003e |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nBuilder(\n text: CharSequence, \n startIndex: Int, \n endIndex: Int)\n```\n\n| Parameters ||\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `text` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html): text providing context for the text to classify (which is specified by the sub sequence starting at startIndex and ending at endIndex) This value cannot be `null`. |\n| `startIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): start index of the text to classify Value is 0 or greater |\n| `endIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): end index of the text to classify Value is 0 or greater |\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): TextClassification.Request\n```\n\nBuilds and returns the request object.\n\n| Return ||\n|--------------------------------------------------------------------------------------------------------|------------------------------|\n| [TextClassification.Request](/reference/kotlin/android/view/textclassifier/TextClassification.Request) | This value cannot be `null`. |\n\n### setDefaultLocales\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setDefaultLocales(defaultLocales: LocaleList?): TextClassification.Request.Builder\n```\n\n| Parameters ||\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `defaultLocales` | [LocaleList](../../os/LocaleList.html#)?: 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. |\n\n| Return ||\n|-----------------------------------------|-------------------------------------------|\n| [TextClassification.Request.Builder](#) | this builder This value cannot be `null`. |\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?): TextClassification.Request.Builder\n```\n\nSets the extended data.\n\n| Parameters ||\n|----------|-------------------------------------------------------------|\n| `extras` | [Bundle](../../os/Bundle.html#)?: This value may be `null`. |\n\n| Return ||\n|-----------------------------------------|-------------------------------------------|\n| [TextClassification.Request.Builder](#) | this builder This value cannot be `null`. |\n\n### setReferenceTime\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setReferenceTime(referenceTime: ZonedDateTime?): TextClassification.Request.Builder\n```\n\n| Parameters ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `referenceTime` | [ZonedDateTime](../../../java/time/ZonedDateTime.html#)?: reference time based on which relative dates (e.g. \"tomorrow\" should be interpreted. This should usually be the time when the text was originally composed. If no reference time is set, now is used. This value may be `null`. |\n\n| Return ||\n|-----------------------------------------|-------------------------------------------|\n| [TextClassification.Request.Builder](#) | this builder This value cannot be `null`. |"]]