# InsertGesture.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/InsertGesture.Builder "View this page in Java")  

```
class Builder
```

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

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

## Summary

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

|                                                                                                                                                                                                                                                                                                             Public methods                                                                                                                                                                                                                                                                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [InsertGesture](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture)                  | [build](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#build())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                     |
| [InsertGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#) | [setFallbackText](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.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.                                                                                                                        |
| [InsertGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#) | [setInsertionPoint](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#setInsertionPoint(android.graphics.PointF))`(`point:` `[PointF](https://developer.android.com/reference/kotlin/android/graphics/PointF.html#)`)` Sets the insertion point (in screen coordinates) where[setTextToInsert(java.lang.String)](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#setTextToInsert(kotlin.String))should be inserted. |
| [InsertGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#) | [setTextToInsert](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#setTextToInsert(kotlin.String))`(`text:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Set the text that will be inserted at[setInsertionPoint(android.graphics.PointF)](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#setInsertionPoint(android.graphics.PointF)).                                    |

## 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(): InsertGesture
```

|                                                                                                                                                                                           Return                                                                                                                                                                                           ||
|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [InsertGesture](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture) | [InsertGesture](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture)using parameters in this[InsertGesture.Builder](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.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?): InsertGesture.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 |

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

### setInsertionPoint

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

```
fun setInsertionPoint(point: PointF): InsertGesture.Builder
```

Sets the insertion point (in screen coordinates) where[setTextToInsert(java.lang.String)](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#setTextToInsert(kotlin.String))should be inserted.

|                                                         Parameters                                                          ||
|---------|--------------------------------------------------------------------------------------------------------------------|
| `point` | [PointF](https://developer.android.com/reference/kotlin/android/graphics/PointF.html#):This value cannot be`null`. |

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

### setTextToInsert

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

```
fun setTextToInsert(text: String): InsertGesture.Builder
```

Set the text that will be inserted at[setInsertionPoint(android.graphics.PointF)](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture.Builder#setInsertionPoint(android.graphics.PointF)). When set with an empty string, cursor will be moved to[getInsertionPoint()](https://developer.android.com/reference/kotlin/android/view/inputmethod/InsertGesture#getInsertionPoint())and no text would be inserted.

|                                                      Parameters                                                      ||
|--------|--------------------------------------------------------------------------------------------------------------|
| `text` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

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