Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set the max. length of text in edittext control

I would like to know how can I set maximum length of text in an edittext control in android. I want the edittext to be able to handle large amount of text. How can I accomplish this. Thanks

like image 939
artist Avatar asked Dec 30 '25 16:12

artist


2 Answers

try this

InputFilter[] FilterArray = new InputFilter[1];
FilterArray[0] = new InputFilter.LengthFilter(8);
editEntryView.setFilters(FilterArray);
like image 86
blessanm86 Avatar answered Jan 02 '26 08:01

blessanm86


In the xml declaration of the edittext you can add the atribute

android:maxLength="100" // or the size that you want
like image 33
caiocpricci2 Avatar answered Jan 02 '26 09:01

caiocpricci2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!