I would like to programmatically set maxLength property of TextView as I don\'t want to hard code it in the layout. I can\'t see any set
maxLength
TextView
set
As João Carlos said, in Kotlin use:
editText.filters += InputFilter.LengthFilter(10)
See also https://stackoverflow.com/a/58372842/2914140 about some devices strange behaviour.
(Add android:inputType="textNoSuggestions" to your EditText.)
android:inputType="textNoSuggestions"
EditText