I have EditText
in it XML written: android:drawableRight="@drawable/promotion_create_promotion_plus_icn"
when setError("sss") the drawableRight change.
I want when setError(null) the drawableRight return to be drawable/promotion_create_promotion_plus_icn
the XML:
<EditText
android:id="@+id/create_benefit_add_titale"
style="@style/promotion_create_promotion_add_title_bcg"
android:drawableRight="@drawable/promotion_create_promotion_plus_icn"
android:hint="@string/create_benefit_add_titale" />
in java:
@Override
public void afterTextChanged(Editable s) {
((EditText) getCurrentFocus()).setError(null);
}
who can help me?
The problem is that the setError(null) clears also the icon.
To restore the original one, add it programmatically:
@Override public void afterTextChanged(Editable s) {
EditText edit = (EditText) getCurrentFocus();
edit.setError(null);
edit.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.promotion_create_promotion_plus_icn, 0);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With