In my app I have an edit user details page and I want to display the current name, email address etc in the corresponding editText fields and then the user can just erase that and enter a new one if they want.
Is there a way to do this? Thanks for any help
You can use
EditText.setText(...)
to set the current text of an EditText field.Example:
First you need to load the user details somehow
Then you need to find your EditText if you don't have it-
EditText et = (EditText)findViewById(R.id.youredittext);
after you've found your EditText, call
From the xml:
You can do it in this way
and inside onCreate method
There is the
hint
feature? You can use thesetHint()
to set it, or set it in XML (though you probably don't want that, because the XML doesn't 'know' the name/adress of your user :) )