0

how to make edittext should get unique letters as input.

if already letter is there in the edittext we should filter it

Thanks in advance.

SathishBabu S
  • 382
  • 3
  • 11

3 Answers3

0

You can check inserted text after each input character.

by implementing TextWatcher

see this answer

you can write your code in

@Override
public void afterTextChanged(Editable s) {
     // your code for checking unique character here

}
Community
  • 1
  • 1
MAC
  • 15,799
  • 8
  • 54
  • 95
0

My idea is you register a TextWatcher to your EditText and override afterTextChanged.

And store it using Shared Preferences.

Lawrence Gimenez
  • 2,662
  • 4
  • 34
  • 52
0

try using TextWatcher to filter chars input by user

   TextWatcher mTextWatcher = new TextWatcher() {
        private CharSequence temp;

        @Override
        public void beforeTextChanged(CharSequence s, int arg1, int arg2,
                int arg3) {
            temp = s;
        }

        @Override
        public void onTextChanged(CharSequence s, int arg1, int arg2,
                int arg3) {

        }

        @Override
        public void afterTextChanged(Editable s) {

                   //CHECK HERE FOR UNIQUE LETTERS as INPUT BY USER and REMOVE IT
            }
        }
    };
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213