Skip to content

//workflow/com.squareup.workflow1.ui/setTextChangedListener

setTextChangedListener

[androidJvm]
Content
@WorkflowUiExperimentalApi()

fun EditText.setTextChangedListener(listener: (CharSequence) -> Unit?)
More info

Helper for setting a simple function as a callback to be invoked whenever an EditText text value changes. Simpler than manually invoking EditText.removeTextChangedListener and EditText.addTextChangedListener and implementing a whole TextWatcher manually.

If listener is not null, it will be invoked any time the text changes either due to the OS/user (e.g. IME connection, soft keyboard, etc.), or programmatically (i.e. setText), except by calls to updateText, which will not fire this listener. It will also not fire if the text is technically changed, but to the same value (e.g. setText(“foo”); setText(“foo”) will only fire the listener at most once).

Intended to be used by LayoutRunners for updating EditTexts from workflow renderings.