I am developing an application for keyboard, but i am geting an issue. I want to restrict/block some special character from soft keyboard in EditText in android programmatic
you can prevent for typing special character:
yourEditText.addTextChangedListener(new TextWatcher() {
CharSequence previous;
public void afterTextChanged(Editable s) {
if(s.toString().contains("&^%$#*&(")){
s.clear();
s.append(previous.toString());
}
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
previous = s;
}
public void onTextChanged(CharSequence s, int start, int before, int count) {}
});