I recently used the code of the first answer on this question for an app. To make it less hardcoded I made an EditText widget in Android Studio for the sender email address (and password) and extracted the information from it in my OnClick function by these two lines of code:
et_email_from = (EditText) findViewById (R.id.et_email_from);
final String user = et_email_from.getText().toString();
The problem is that once I click the button and the sendMail function is called, I can't change the sender address anymore. I mean I can, but the app will still send it from the first sender email address. Can someone show me how I can solve this problem? I think it has something to do with where in the code the connection is made with the server, but I'm new to coding in Java and I don't know where to find this code.