How can I add a placeholder text to EditText in the class that isn’t in the XML?
I have the following EditText in my code which will be shown in alertdialog:
final EditText name = new EditText(this);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.EDIT
And in XML, it’s simply
android:hint="someText"