Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder for SelectGesture
. This class is not designed to be thread-safe.
Summary
Public constructors
Public methods
build
fun build(): SelectGesture
Exceptions |
java.lang.IllegalArgumentException |
if one or more positional parameters are not specified. |
setFallbackText
fun setFallbackText(fallbackText: String?): SelectGesture.Builder
Set fallback text that will be committed at current cursor position if there is no applicable text beneath the area of gesture.
Parameters |
fallbackText |
String?: text to set This value may be null . |
setGranularity
fun setGranularity(granularity: Int): SelectGesture.Builder
Define text selection granularity. Intersecting words/characters will be included in the operation.
setSelectionArea
fun setSelectionArea(area: RectF): SelectGesture.Builder
Set rectangular single/multiline text selection area intersecting with text. The resulting selection would be performed for all text intersecting rectangle. The selection includes the first word/character in the rectangle, and the last word/character in the rectangle, and includes everything in between even if it's not in the rectangle. Intersection is determined using setGranularity(int)
. e.g. HandwritingGesture.GRANULARITY_WORD
includes all the words with their width/height center included in the selection rectangle.
Parameters |
area |
RectF: RectF (in screen coordinates) for which text will be selection. This value cannot 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,["# SelectGesture.Builder\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/inputmethod/SelectGesture.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.inputmethod.SelectGesture.Builder](#) |\n\nBuilder for [SelectGesture](/reference/kotlin/android/view/inputmethod/SelectGesture). This class is not designed to be thread-safe.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [SelectGesture](/reference/kotlin/android/view/inputmethod/SelectGesture) | [build](#build())`()` \u003cbr /\u003e |\n| [SelectGesture.Builder](#) | [setFallbackText](#setFallbackText(kotlin.String))`(`fallbackText:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Set fallback text that will be committed at current cursor position if there is no applicable text beneath the area of gesture. |\n| [SelectGesture.Builder](#) | [setGranularity](#setGranularity(kotlin.Int))`(`granularity:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Define text selection granularity. |\n| [SelectGesture.Builder](#) | [setSelectionArea](#setSelectionArea(android.graphics.RectF))`(`area:` `[RectF](../../graphics/RectF.html#)`)` Set rectangular single/multiline text selection area intersecting with text. |\n\nPublic constructors\n-------------------\n\n### Builder\n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): SelectGesture\n```\n\n| Return ||\n|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| [SelectGesture](/reference/kotlin/android/view/inputmethod/SelectGesture) | [SelectGesture](/reference/kotlin/android/view/inputmethod/SelectGesture) using parameters in this [Builder](#). This value cannot be `null`. |\n\n| Exceptions ||\n|--------------------------------------|---------------------------------------------------------|\n| `java.lang.IllegalArgumentException` | if one or more positional parameters are not specified. |\n\n### setFallbackText\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setFallbackText(fallbackText: String?): SelectGesture.Builder\n```\n\nSet fallback text that will be committed at current cursor position if there is no applicable text beneath the area of gesture.\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------------------------------------------------|\n| `fallbackText` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: text to set This value may be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [SelectGesture.Builder](#) | This value cannot be `null`. |\n\n### setGranularity\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setGranularity(granularity: Int): SelectGesture.Builder\n```\n\nDefine text selection granularity. Intersecting words/characters will be included in the operation.\n\n| Parameters ||\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `granularity` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): [HandwritingGesture.GRANULARITY_WORD](/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_WORD:kotlin.Int) or [HandwritingGesture.GRANULARITY_CHARACTER](/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_CHARACTER:kotlin.Int). Value is [android.view.inputmethod.HandwritingGesture#GRANULARITY_CHARACTER](/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_CHARACTER:kotlin.Int), or [android.view.inputmethod.HandwritingGesture#GRANULARITY_WORD](/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_WORD:kotlin.Int) |\n\n| Return ||\n|----------------------------|--------------------------------------------|\n| [SelectGesture.Builder](#) | [Builder](#). This value cannot be `null`. |\n\n### setSelectionArea\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setSelectionArea(area: RectF): SelectGesture.Builder\n```\n\nSet rectangular single/multiline text selection area intersecting with text. The resulting selection would be performed for all text intersecting rectangle. The selection includes the first word/character in the rectangle, and the last word/character in the rectangle, and includes everything in between even if it's not in the rectangle. Intersection is determined using [setGranularity(int)](#setGranularity(kotlin.Int)). e.g. [HandwritingGesture.GRANULARITY_WORD](/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_WORD:kotlin.Int) includes all the words with their width/height center included in the selection rectangle.\n\n| Parameters ||\n|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `area` | [RectF](../../graphics/RectF.html#): [RectF](../../graphics/RectF.html#) (in screen coordinates) for which text will be selection. This value cannot be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [SelectGesture.Builder](#) | This value cannot be `null`. |"]]