As you can disable certain keys on the keyboard to prevent the user to input wrong characters?
Asked
Active
Viewed 2,196 times
2
-
input of a hexadecimal number – whiteTIGER May 18 '12 at 08:47
-
ok..are you want to restrict certain input? then you can try different input types in xml – dreamcoder May 18 '12 at 08:49
1 Answers
0
the following code is to disable numbers and chars
{
final InputFilter filter = new InputFilter() {
@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.isDigit(source.charAt(i))||Character.isLetter(source.charAt(i)))
{
return "";
}
}
return null;
}
};
answerTXT.setFilters(new InputFilter[]{filter});
}

Jitesh Prajapati
- 2,533
- 4
- 29
- 51

Osama Ibrahim
- 995
- 10
- 13