7
votes

I was working on 'setError' to show error messages.

My requirement is to change the red popup lines of setError() view to black and I'm trying to use "android:errorMessageBackground" in styles.xml which extends EditText widget. But unfortunately i'm getting "No Resource found error"

Using Theme : Theme.NoTitleBar Used Base API: 2.2 (Even tried with 4.0.3 also)

1
do you have any sample regarding aboveuser1903427
can i use <item name="android:errorMessageBackground"></item> for changing error popup viewuser1903427

1 Answers

-1
votes

check edittext input data where you needed, if it is null then use edittext.setError() method to show error.

if( editText.getText().toString().trim().equalsIgnoreCase(""))
     editText.setError("Please enter Value");

And this code remove error from edittext, when you focus or click on edittext to enter data.

editText.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                editText.setError(null);
            }
        });