4

Is there a way of using resources for setError for Edittext?

I tried setError.(getString(R.string.bla)) as well and context.getString(R.string.bla)

No of them sets the error the text bla corresponds in the strings.xml. it gets a number which I guess resources reference value.

Any Idea that how can I use the string resources for setError?

Thanks

akd
  • 6,538
  • 16
  • 70
  • 112

1 Answers1

26

The easiest way is to use getText() (returns a CharSequence) instead of getString() (which returns a String). Example:

editText.setError(getText(R.string.bla));
  • Strangely enough but now it works:) I just cleaned the project and setError.(getString(R.string.bla)) works now. cheers. – akd Dec 27 '11 at 21:00