Tag Archives: Hint

On TextView Hints and StringUtils.isBlank

I had a problem caused by setting empty or blank strings to the TextView and AutoCompleteTextView – hints were invisible after that. So I decided to check strings, that are set, if they were not only empty, but also not blank. I used StringUtils.isBlank instead of StringUtils.isEmpty: it works much better now, and hints are always visible. If you don’t still use StringUtils, I highly recommend you to do. This is a Gradle import for a library that contains them:

And another example with AutoCompleteTextView:

Here is some information on how isNotEmpty and isNotBlank are working.

Title of this article: On Android TextView and AutoCompleteTextView Hint and StringUtils.isBlank and .isEmpty