I have two Edit Fields “Username” and “Password” and everytime i revert back to this page containing these fields, the values do not get erased. I tried using the following code, but to no help :
username = (EditText) findViewById(R.id.enterUsername);
password = (EditText) findViewById(R.id.enterPassword);
username.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
username.setText("");
}
});
password.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
password.setText("");
}
});
what could be done in order to erase the previous entries of the EditText fields when going back to the same activity ?
In your Activity onResume() you do this to clear EditText data.
Thanks