gkotla gkotla - 5 months ago 37
Android Question

how to put hint to edittext

I have two edittext input box. First one is for username and the second one is for password. I want put hint on the inputbox. I have wrote hint with settex() method. In addition, I have wrote

in onclick(view v)


in oncreate

text1 = findViewById(R.id.editText_1);

whenever I have click on the input box, hint should dissappear. But, hint is not dissappeared. Now, is the way I am doing wrong? Or I have missed something?




instead. setHint() provides the hint that disappears when the user types something. You can also use a String resource ID or an xml based approach, but in your case, using the String method will suffice.

Only use setText() when you want to put text in the EditText that the user can modify.