2

As you can disable certain keys on the keyboard to prevent the user to input wrong characters?

whiteTIGER
  • 391
  • 1
  • 6
  • 19

1 Answers1

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