Payday Loan Payday Loan

As you observed, there is no direct method to limit the number of characters that can be typed in am EditText.
However, there is a solution using InputFilter. Follow the below script and you can set up maximum numbers of characters you allow to be entered in an EditText.

  int maxLength = 50;
  InputFilter[] FilterArray = new InputFilter[1];
  FilterArray[0] = new InputFilter.LengthFilter(maxLength);
  editText.setFilters(FilterArray);

To use InputFilter, you must import android.text.InputFilter;

||||| 0 I Like It! |||||

Search

Popular

Sponsors