Q:

Hide passwordToggleEnable when error warnings occur

can we hide passwordToggle temporary when user get warning error and display it back when user fill the EditText with some data, look at this picture
 and 
if i tried this 
if (etPassNow.length() == 0){
    etPassNow.setError("No data");
    textInputLayout.setPasswordVisibilityToggleEnabled(false);
} 

then the result is like this 
, but this is what i want  there's an icon error above error warning,
has anyone ever meet this issue?  Thank you
This is my xml
<android.support.design.widget. TextInputLayout
        android:id="@+id/ti_new_pass"
        android:layout_width="250dp"
        android:layout_height="50dp"
        android:layout_gravity="center"
        app:passwordToggleEnabled="true">
        <android.support.design.widget. TextInputEditText
            android:id="@+id/et_new_pass"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Kata Sandi Baru"
            android:imeOptions="actionDone"
            android:inputType="textPassword"
            android:paddingBottom="25dp"
            android:paddingStart="30dp"
            android:singleLine="true"
            android:textColor="@color/dc_gray"
            android:textSize="16sp"/>
</android.support.design.widget. TextInputLayout>

A:

This is my conclusion after getting trial error, i'm checking the error if field empty in onClick action
if (etPassNow.length() == 0)
     etPassNow.setError("Please fill data");

and for passwordToggle i activate it in onTextChange
etPassNow.addTextChangeListener(this);

public void onTextChanged(CharSequence s, int start, int before, int count){
     if (etPassNow.getText().toString().length() > 0)
          textInputLayout.setPasswordVisibilityToggleEnabled(true);
     else
          textInputLayout.setPasswordVisibilityToggleEnabled(false);
}

this is the easiest way for my case

