Dzeferson
Dzeferson

Reputation: 26

How to change TextView max length?

So I want to make a button which would modify the max length of a textview. I have been trying to do this or find an answer to it for hours, but I can't find anything. Any help would be really appreciated.

Upvotes: 0

Views: 64

Answers (1)

Nitesh
Nitesh

Reputation: 3903

Try this

public void setEditTextMaxLength(int length) {
    InputFilter[] FilterArray = new InputFilter[1];
    FilterArray[0] = new InputFilter.LengthFilter(length);
    edt_text.setFilters(FilterArray);
}

Upvotes: 1

Related Questions