0

I Had try

        mTextInputLayout.seterror(null);
        mTextInputLayout.setErrorEnabled(false);

how to set error or remove after correction set boarder as default in TextInputLayout Android Application

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
Vinod Ranga
  • 511
  • 8
  • 15

2 Answers2

0

To set error in TextInputLayout , you have to give that

for example,

            <LinearLayout
                android:id="@+id/login_userbar"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">

                <android.support.design.widget.TextInputLayout
                    android:id="@+id/username_text_input_layout" 
                    style="@style/TextLabel"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <EditText
                        android:id="@+id/etUsername"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"/>

                </android.support.design.widget.TextInputLayout>
            </LinearLayout>

check this SO answer

Community
  • 1
  • 1
Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
0

If your trying to validate a EditText field, try adding a TextWatcher to your EditText field.

For Example

mText.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(Editable edt){
      if( mText.getText().length() > 7){
        mText.setError("The input should be grater than 7 characters long");
      }else{
        mText.setError(null);
      }
    }
}

As per Android Developer documentation, setError(null) should work to clear errors. For more information Click Here.

whit3hawks
  • 429
  • 7
  • 14