I want to know how I can get the text from an edittext in Activity B and put that text on the button of Activity A. I want to make it so that when i press the “enter” button on activity b it will get the text of the edittext and replace the text of a button in activity A. I think its something like this
public void pressEnter (View v){
EditText et = (EditText) findViewById(R.id.editText1);
String t = et.getText().toString();
Button p1_button = (Button)findViewById(R.id.button1);
p1_button.setText(t);
}
but i dont know how to get the ID of the button from activity A that I want to set the text to.
One option would be to start Activity B with
startActivityForResult().Good example of usage can be found in this answer.