How can I add a placeholder text to EditText in the class that isn't in the XML?
EditText
I have the following EditText in my code which will be shown in alertdialog:
final EditText name = new EditText(this);
Ah, ok. What you're looking for is setHint(int). Simply pass in a resource id of a string from your xml and you're good to go.
setHint(int)
And in XML, it's simply android:hint="someText"
android:hint="someText"
2.1m questions
2.1m answers
60 comments
56.6k users