InputFilter restrict enter key in multiline EdiText Android

78 views Asked by At

HI I am using InputFilter to restrict some character in EditText, while adding InputFilter I can't able to go to new line while pressing enter in KeyBoard

public class AddressDetailFilter implements InputFilter {

@Override
public CharSequence filter(CharSequence src, int i, int i1, Spanned spanned, int i2, int i3) {
    if(src.equals("")){ // for backspace
        return src;
    }
    if(src.toString().matches("[a-zA-Z 0-9()@.,;-]+")){
        return src;
    }
    return "";
}

}

0

There are 0 answers