# SelectGesture.Builder

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/view/inputmethod/SelectGesture.Builder "View this page in Java")  

```
class Builder
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                   ||
| ↳ | [android.view.inputmethod.SelectGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#) |

Builder for[SelectGesture](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture). This class is not designed to be thread-safe.

## Summary

|                                                       Public constructors                                                        ||
|-------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#Builder())`()` <br /> |

|                                                                                                                                                                                                                                                 Public methods                                                                                                                                                                                                                                                  ||
|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SelectGesture](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture)                  | [build](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#build())`()` <br />                                                                                                                                                                                                                                                              |
| [SelectGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#) | [setFallbackText](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#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. |
| [SelectGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#) | [setGranularity](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#setGranularity(kotlin.Int))`(`granularity:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Define text selection granularity.                                                                                                           |
| [SelectGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#) | [setSelectionArea](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#setSelectionArea(android.graphics.RectF))`(`area:` `[RectF](https://developer.android.com/reference/kotlin/android/graphics/RectF.html#)`)` Set rectangular single/multiline text selection area intersecting with text.                                              |

## Public constructors

### Builder

```
Builder()
```

## Public methods

### build

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): SelectGesture
```

|                                                                                                                                                                                    Return                                                                                                                                                                                    ||
|--------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SelectGesture](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture) | [SelectGesture](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture)using parameters in this[Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#). This value cannot be`null`. |

|                                          Exceptions                                           ||
|--------------------------------------|---------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if one or more positional parameters are not specified. |

### setFallbackText

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?:text to set This value may be`null`. |

|                                                                        Return                                                                        ||
|-------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [SelectGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#) | This value cannot be`null`. |

### setGranularity

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setGranularity(granularity: Int): SelectGesture.Builder
```

Define text selection granularity. Intersecting words/characters will be included in the operation.

|                                                                                                                                                                                                                                                                                                                                                                                                              Parameters                                                                                                                                                                                                                                                                                                                                                                                                              ||
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `granularity` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):[HandwritingGesture.GRANULARITY_WORD](https://developer.android.com/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_WORD:kotlin.Int)or[HandwritingGesture.GRANULARITY_CHARACTER](https://developer.android.com/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_CHARACTER:kotlin.Int). Value is[android.view.inputmethod.HandwritingGesture#GRANULARITY_CHARACTER](https://developer.android.com/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_CHARACTER:kotlin.Int), or[android.view.inputmethod.HandwritingGesture#GRANULARITY_WORD](https://developer.android.com/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_WORD:kotlin.Int) |

|                                                                                                                             Return                                                                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| [SelectGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#) | [Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#). This value cannot be`null`. |

### setSelectionArea

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
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)](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#setGranularity(kotlin.Int)). e.g.[HandwritingGesture.GRANULARITY_WORD](https://developer.android.com/reference/kotlin/android/view/inputmethod/HandwritingGesture#GRANULARITY_WORD:kotlin.Int)includes all the words with their width/height center included in the selection rectangle.

|                                                                                                                               Parameters                                                                                                                               ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `area` | [RectF](https://developer.android.com/reference/kotlin/android/graphics/RectF.html#):[RectF](https://developer.android.com/reference/kotlin/android/graphics/RectF.html#)(in screen coordinates) for which text will be selection. This value cannot be`null`. |

|                                                                        Return                                                                        ||
|-------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [SelectGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/SelectGesture.Builder#) | This value cannot be`null`. |