fuadj
fuadj

Reputation: 454

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 editText.setError(). So my question is, is there a setError equivalent for when the user has done the correct thing.

Upvotes: 0

Views: 408

Answers (2)

Alexandre Martin
Alexandre Martin

Reputation: 1502

We can set the style of the setError popup with fromHtml method.

You can also use this : https://github.com/sherifelkhatib/WidgyWidgets

Upvotes: 0

bradkratky
bradkratky

Reputation: 1617

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

textEdit.addTextChangedListener(new TextWatcher() {

   @Override
   public void afterTextChanged(Editable s) {}

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

   @Override    
   public void onTextChanged(CharSequence s, int start,
     int before, int count) {
      // validate text and inform user
   }
});

Upvotes: 1

Related Questions