I limited the input of my edittext as follows:
InputFilter filter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
String output = "";
for (int i = start; i < end; i++) {
if (source.charAt(i)!='~'&&source.charAt(i)!='/') {
output += source.charAt(i);
}
}
return output;
}
};
But anyone who has used this method will know that it causes repeated characters when it is mixed with auto-correction and the backspace keyword. To solve this problem, I removed the auto-correction from the keyboard as follows:
Edittect.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
Now it works perfectly on the Android keyboard, but the problem is with alternative keyboards (from the Google game), this does not disable the automatic fix, and therefore I again encountered the problem of repeating characters. Has anyone come across this / knew how to solve it?
source
share