I have a TextInputLayout with an EditText inside it.
This is my xml:
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter Text" />
</android.support.design.widget.TextInputLayout>
My java code:
((TextInputLayout) findViewById(R.id.textInputLayout)).setError("ERROR");
When I call setError("ERROR"), the and the label(hint) color and EditText's bottom line color gets changed to red and the error appears. This is the behaviour that I expect.
Now let's say I do not call setError(null) before destroying my activity. Now I open the same activity again. I can see that the bottom line remains red for all EditText fields inside in my application, although the label colour seems to be reset and the error message is dismissed. This is not always reproducible, but if I keep trying, I can eventually get it.
I am using a Nexus 4 with 5.1.1.
Am I doing something wrong?