Created
February 26, 2020 18:02
-
-
Save oscarito9410/5e6d223cc6e0b56f7956df1e5f1252f5 to your computer and use it in GitHub Desktop.
Input filter alphanumeric android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InputFilter filter = new InputFilter() { | |
public CharSequence filter(CharSequence source, int start, int end, | |
Spanned dest, int dstart, int dend) { | |
for (int i = start; i < end; i++) { | |
if (!Character.isLetterOrDigit(source.charAt(i))) { | |
return ""; | |
} | |
} | |
return null; | |
} | |
}; | |
edit.setFilters(new InputFilter[]{filter}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment