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
  • 384
  • 2
  • 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,659
  • 8
  • 53
  • 95
0

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

And store it using Shared Preferences.

Lawrence Gimenez
  • 2,210
  • 3
  • 29
  • 48
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
  • 130,641
  • 51
  • 193
  • 212