The mechanism used to receive values from a Activity after it is abandoned is, by evoking it, to use startActivityForResult()
instead of startActivity()
.
At first Activity:
static final int ACTIVITY_2_REQUEST = 1;
Intent i = new Intent(this, SegundaActivity.class);
startActivityForResult(i, ACTIVITY_2_REQUEST);
In the second Activity:
//Quando tiver o resultado pronto para ser devolvido à primeira activity
String resultado = seuTextView.getText().toString();
Intent returnIntent = new Intent();
returnIntent.putExtra("resultado",resultado);
setResult(RESULT_OK,returnIntent);
To receive the value do the override of the method onActivityResult()
at first Activity:
@override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ACTIVITY_2_REQUEST) {
if(resultCode == RESULT_OK){
String resultado = data.getStringExtra("resultado");
//Coloque no EditText
seuEditText.setText(resultado);
}
}
}