Попробуйте создать собственный фильтр InputLength.Это будет выглядеть примерно так: (CustomLengthFilter.java) import android.text.InputFilter;
public class CustomLengthFilter extends InputFilter.LengthFilter {
int maxLength;
public CustomLengthFilter(int max) {
super(max);
maxLength = max;
}
public int get_MaxLength(){
return maxLength;
}
}
Затем в вашем editText:
InputFilter[] inputFilterCollection = this.getFilters();
CustomLengthFilter mCustomLengthFilter = null;
for(InputFilter eachInputFilter : inputFilterCollection){
if(eachInputFilter instanceof CustomLengthFilter){
mCustomLengthFilter = (CustomLengthFilter) eachInputFilter;
}
}
if(mCustomLengthFilter != null){
int maxLength = mCustomLengthFilter.get_MaxLength();
}