This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/android/forms/create-edit-and-remove/disable-editing.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Disable PDF form editing on Android | Nutrient SDK

You can disable modification of a specific form field by calling setReadOnly(true) on the FormField and call setReadOnly(false) later to make it editable again.

lifecycleScope.launch {
document.formProvider
.getFormFieldWithFullyQualifiedName("Text Field 1")
?.setReadOnly(true)
}

To call suspend functions from Java without blocking a thread, see calling asynchronous APIs from Java.

Registered OnFormFieldUpdatedListeners are notified when the field’s read-only state changes.

getFormFieldWithFullyQualifiedName() is a suspend function and returns null if the document has no field with that name. In Kotlin, call it from a coroutine. In Java, only call it with runBlocking() on a worker thread, never on the main thread.

If you need to prevent filling only a specific widget annotation, set the widget annotation’s AnnotationFlags.LOCKEDCONTENTS flag. The widget annotation’s READONLY flag doesn’t prevent form filling on Android. For more information, refer to the annotation flags guide.

Disabling custom values in combo boxes

A combo box can accept values that aren’t in its option list only if the PDF form field is marked as editable. Use ComboBoxFormElement#isEditable() to check whether that custom text input is enabled for the field.

To prevent custom values, change the form field definition so the combo box isn’t editable. If you need to block all user edits to the field, make the corresponding widget annotation read-only with AnnotationFlags.READONLY.

Disabling all form interactions

You can disable all form interactions and modifications using formEditingEnabled(false):

val builder = PdfActivityConfiguration.Builder(context)
builder.formEditingEnabled(false)