Reputation: 2266
I would like to programmatically set the maxLength
property of EditText
as I don't want to set it in the layout file. I can't see any set method related to maxLength
.
Upvotes: 0
Views: 661
Reputation: 2266
You must set it as an input filter, and can set an array of input filter in same time.
You can set the maxLenght like this code:
field.filters = arrayOf<InputFilter>(InputFilter.LengthFilter(data.maximum ?: 0))
Upvotes: 1