fuadj fuadj - 2 years ago 170
Android Question

EditText valid input indicator

I have a validation for an editText where a user inputs an id. The id has a minimum length of 6 and has error detection. I want to inform the user when a correct id is entered right away. I've searched online and most of what i've found is the case of telling the user of invalid input through methods like

. So my question is, is there a
equivalent for when the user has done the correct thing.

Answer Source

You can use the TextChangeListener to perform events when the user changes the text.

textEdit.addTextChangedListener(new TextWatcher() {

   public void afterTextChanged(Editable s) {}

   public void beforeTextChanged(CharSequence s, int start,
     int count, int after) {

   public void onTextChanged(CharSequence s, int start,
     int before, int count) {
      // validate text and inform user
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download