---
title: "Fill PDF form fields programmatically on Android | Nutrient"
canonical_url: "https://www.nutrient.io/guides/android/forms/form-filling/"
md_url: "https://www.nutrient.io/guides/android/forms/form-filling.md"
last_updated: "2026-06-08T17:11:05.429Z"
description: "Nutrient Android SDK fully supports the AcroForm standard and can view and fill forms inside the PdfFragment/PdfActivity."
---

# Fill PDF form fields programmatically on Android

Nutrient Android SDK fully supports the AcroForm standard and can view and fill forms inside the [`PdfFragment`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/index.html)/[`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html).

Forms are an optional component that can be licensed. If not licensed, forms will simply be invisible. Forms can also be manually switched off via the [`formEditingEnabled(false)`] call when building [`PdfConfiguration`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.configuration/-pdf-configuration/-builder/index.html) or [`PdfActivityConfiguration`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.configuration.activity/-pdf-activity-configuration/index.html).

You can also modify and query forms in code — for example, you can fill out forms programmatically:

### KOTLIN

```kotlin

    val document: PdfDocument =...

    // This code shouldn't run on the main thread. Alternatively, use `getFormFieldsAsync()` to do this
    // processing in the RxJava chain.
    val formFields = document.formProvider.formFields
    formFields.filter { field -> field.type == FormType.TEXT }.forEach { field -> (field.formElement as TextFormElement).setText("Test ${field.name}") }
    formFields.filter { field -> field.type == FormType.CHECKBOX }.forEach { field -> (field.formElement as CheckBoxFormElement).toggleSelection() }

```

### JAVA

```java

    PdfDocument document =...

    // This code shouldn't run on main thread. Alternatively, use `getFormFieldsAsync()` to do this
    // processing in the RxJava chain.
    List<FormField> formFields = document.getFormProvider().getFormFields();
    for (FormField formField : formFields) {
        if (formField.getType() == FormType.TEXT) {
            TextFormElement textFormElement = (TextFormElement) formField.getFormElement();
            textFormElement.setText("Test " + textFormElement.getName());
        } else if (formField.getType() == FormType.CHECKBOX) {
            CheckBoxFormElement checkBoxFormElement = (CheckBoxFormElement)formField.getFormElement();
            checkBoxFormElement.toggleSelection();
        }
    }

```
---

## Related pages

- [Detect user input in Android PDF forms](/guides/android/forms/fill-form-fields/detect-user-input.md)
- [Undo and redo for PDF forms on Android](/guides/android/forms/fill-form-fields/undo-and-redo.md)
- [Detecting user clicks in PDF form elements on Android](/guides/android/forms/fill-form-fields/detect-clicks.md)
- [Form field support in our Android PDF viewer](/guides/android/forms/fill-form-fields/using-the-ui.md)
- [Attach files to PDF form fields on Android](/guides/android/forms/fill-form-fields/attach-a-file.md)

