Android EditText background text-ThrowExceptions

Exception or error:

Is there a way to set the background text of an EditText? for instance, I have a login screen with 2 EditText views, one for username and one for password. I want the text “Username” and “Password” be written inside the EditText, and once the user touches those the text disappears but once user deleted his own entry, text re-appears.

Is there a property for that or should I implement this on my own with events and stuff?

How to solve:

The hint property will take care of that for you.


Use hint property, or setHint method.

Leave a Reply

Your email address will not be published. Required fields are marked *