Umang
Umang

Reputation: 593

android - how to prefill Edittext?

I have an app where I am storing the usernames. Once the user clicks on his username, it goes to the login screen. Can it be done that the username be already inputted in the login screen. , so that the user only has to enter his password? Any help would be appreciated. Thanks!

Upvotes: 9

Views: 8403

Answers (2)

Pattabi Raman
Pattabi Raman

Reputation: 5854

you can use following code in xml:

android:text="<your text here>"

or

android:hint="<your text here>"

but there is more difference between those to android:text and android:hint, first one sets the text and second one will display untill any text entered.

Upvotes: 9

Wroclai
Wroclai

Reputation: 26925

Use the setText() function.

Upvotes: 12

Related Questions