import android.text.InputFilter;
import android.text.Spanned;
EditText editText;
editText.setFilters(new InputFilter[]{new InputFilter.AllCaps() {
@Override
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))) {
android.util.Log.d(TAG, "filter: ");
return "";
}
}
return null;
}
}});