cassiosteel
cassiosteel

Reputation: 1

How can I get the maximum length of a textView in Android?

Hello I created a textview in the main layout, with a certain value for android:maxLength. Now I'd like to get that value back into an int variable; I know how to refer to the textView in Java, but there are no direct methods in the TextView Object to get its maximium length. Is there any way to obtain this value?

Upvotes: 0

Views: 1759

Answers (1)

Malcolm
Malcolm

Reputation: 41510

Unfortunately, you can't. When you set maximum length what actually happens is that a new InputFilter.LengthFilter is created and added to input filters of this field. You can retrieve all the filters of this TextView, but even if you find this particular filter, you can't find out what was the maximum size.

Upvotes: 1

Related Questions