# FormWidgetInfo.Builder

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/graphics/pdf/models/FormWidgetInfo.Builder "View this page in Java")  

```
class Builder
```

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

Builder for[FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)

## Summary

|                                                                                                                                                                                                                                                                                                                                                            Public constructors                                                                                                                                                                                                                                                                                                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#Builder(kotlin.Int,%20kotlin.Int,%20android.graphics.Rect,%20kotlin.String,%20kotlin.String))`(`widgetType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `widgetIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `widgetRect:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)`, `textValue:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `accessibilityLabel:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Creates an instance |

|                                                                                                                                                                                                                                                                          Public methods                                                                                                                                                                                                                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)                  | [build](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#build())`()` Builds a[FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)                                                                                                                                                                                          |
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | [setEditableText](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#setEditableText(kotlin.Boolean))`(`editableText:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether this widget contains editable text.                                                                                                                       |
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | [setFontSize](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#setFontSize(kotlin.Float))`(`fontSize:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Sets the font size for this widget.                                                                                                                                                      |
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | [setListItems](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#setListItems(kotlin.collections.MutableList))`(`listItems:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[ListItem](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/ListItem)!>`)` Sets the choice options for this widget. |
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | [setMaxLength](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#setMaxLength(kotlin.Int))`(`maxLength:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the maximum character length of input text supported by this widget.                                                                                                                   |
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | [setMultiLineText](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#setMultiLineText(kotlin.Boolean))`(`multiLineText:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether this widget supports multi-line text input.                                                                                                            |
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | [setMultiSelect](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#setMultiSelect(kotlin.Boolean))`(`multiSelect:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether this widget supports multiple choice selections.                                                                                                             |
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | [setReadOnly](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#setReadOnly(kotlin.Boolean))`(`readOnly:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets whether this widget is read-only                                                                                                                                              |

## Public constructors

### Builder

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
Builder(
    widgetType: Int, 
    widgetIndex: Int, 
    widgetRect: Rect, 
    textValue: String, 
    accessibilityLabel: String)
```

Creates an instance

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ||
|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `widgetType`         | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the type of widget Value is[android.graphics.pdf.models.FormWidgetInfo#WIDGET_TYPE_UNKNOWN](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#WIDGET_TYPE_UNKNOWN:kotlin.Int),[android.graphics.pdf.models.FormWidgetInfo#WIDGET_TYPE_PUSHBUTTON](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#WIDGET_TYPE_PUSHBUTTON:kotlin.Int),[android.graphics.pdf.models.FormWidgetInfo#WIDGET_TYPE_CHECKBOX](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#WIDGET_TYPE_CHECKBOX:kotlin.Int),[android.graphics.pdf.models.FormWidgetInfo#WIDGET_TYPE_RADIOBUTTON](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#WIDGET_TYPE_RADIOBUTTON:kotlin.Int),[android.graphics.pdf.models.FormWidgetInfo#WIDGET_TYPE_COMBOBOX](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#WIDGET_TYPE_COMBOBOX:kotlin.Int),[android.graphics.pdf.models.FormWidgetInfo#WIDGET_TYPE_LISTBOX](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#WIDGET_TYPE_LISTBOX:kotlin.Int),[android.graphics.pdf.models.FormWidgetInfo#WIDGET_TYPE_TEXTFIELD](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#WIDGET_TYPE_TEXTFIELD:kotlin.Int), or[android.graphics.pdf.models.FormWidgetInfo#WIDGET_TYPE_SIGNATURE](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#WIDGET_TYPE_SIGNATURE:kotlin.Int) |
| `widgetIndex`        | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index of the widget in the page's "Annot" array in the PDF Value is 0 or greater                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `widgetRect`         | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#):the[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)in page coordinates occupied by the widget This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `textValue`          | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the widget's text value This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `accessibilityLabel` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):the field's accessibility label This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

|                                             Exceptions                                              ||
|----------------------------------|-------------------------------------------------------------------|
| `java.lang.NullPointerException` | if any of`widgetRect`,`textValue`, or`accessibilityLabel`are null |

## Public methods

### build

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
fun build(): FormWidgetInfo
```

Builds a[FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo) | This value cannot be`null`. |

### setEditableText

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
fun setEditableText(editableText: Boolean): FormWidgetInfo.Builder
```

Sets whether this widget contains editable text. Only supported for comboboxes and text fields

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | This value cannot be`null`. |

|                                        Exceptions                                         ||
|--------------------------------------|-----------------------------------------------------|
| `java.lang.IllegalArgumentException` | if this is not a combobox or text field type widget |

### setFontSize

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
fun setFontSize(fontSize: Float): FormWidgetInfo.Builder
```

Sets the font size for this widget. Only supported for text fields and comboboxes

|                                                     Parameters                                                      ||
|------------|---------------------------------------------------------------------------------------------------------|
| `fontSize` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):Value is 0.0f or greater |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | This value cannot be`null`. |

|                                                      Exceptions                                                       ||
|--------------------------------------|---------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if this is not a combobox or text field, or if a negative font size is supplied |

### setListItems

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
fun setListItems(listItems: MutableList<ListItem!>): FormWidgetInfo.Builder
```

Sets the choice options for this widget. Only supported for comboboxes and list boxes

|                                                                                                                      Parameters                                                                                                                      ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `listItems` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[ListItem](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/ListItem)!\>:This value cannot be`null`. |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | This value cannot be`null`. |

|                                 Exceptions                                  ||
|--------------------------------------|---------------------------------------|
| `java.lang.IllegalArgumentException` | if this is not a combobox or list box |
| `java.lang.NullPointerException`     | if`choiceOptions`is null              |

### setMaxLength

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
fun setMaxLength(maxLength: Int): FormWidgetInfo.Builder
```

Sets the maximum character length of input text supported by this widget. Only supported for text fields

|                                                  Parameters                                                   ||
|-------------|--------------------------------------------------------------------------------------------------|
| `maxLength` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is 0 or greater |

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | This value cannot be`null`. |

|                                                 Exceptions                                                 ||
|--------------------------------------|----------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if this is not a text field, or if a negative max length is supplied |

### setMultiLineText

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
fun setMultiLineText(multiLineText: Boolean): FormWidgetInfo.Builder
```

Sets whether this widget supports multi-line text input. Only supported for text fields

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | This value cannot be`null`. |

|                            Exceptions                             ||
|--------------------------------------|-----------------------------|
| `java.lang.IllegalArgumentException` | if this is not a text field |

### setMultiSelect

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
fun setMultiSelect(multiSelect: Boolean): FormWidgetInfo.Builder
```

Sets whether this widget supports multiple choice selections. Only supported for list boxes

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | This value cannot be`null`. |

|                           Exceptions                            ||
|--------------------------------------|---------------------------|
| `java.lang.IllegalArgumentException` | if this is not a list box |

### setReadOnly

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[S Extensions 13](https://developer.android.com/sdkExtensions)  

```
fun setReadOnly(readOnly: Boolean): FormWidgetInfo.Builder
```

Sets whether this widget is read-only

|                                                                          Return                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo.Builder](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo.Builder#) | This value cannot be`null`. |