, SO . @njzk2 . , .
maxLength EditText InputFilter, .
InputFilter.LengthFilter, null, . (. )
: InputFilter.LengthFilter, super null, , .
editText.setInputFilters(new InputFilter[] {
new InputFilter.LengthFilter(max) {
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
CharSequence res = super.filter(source, start, end, dest, dstart, dend);
if (res != null) {
Toast.makeText(this,"OVERFLOW!",Toast.LENGTH_SHORT).show();
}
return res;
}
}
});