Extracting information from edit text into another action?

I have this field EditTextinside one action, and I want it to be, when I press the button attached to this field, the field is pulled into another text field in another action. Actually, I'm not sure about that. Any suggestions?

Thanks for the help.

+3
source share
1 answer

Inside ActivityA, if you want to start another action, follow these steps:

Intent intent = new Intent(this, Activity.B);
// pass the content of your EditText as parameter to the intent you use to start the other activity
intent.putExtra("string", editText.getText().toString(); 
startActivity(intent);

and in ActivityB onCreate () you are doing something like

// retrieve the text and show it in the TextView
textView.setText(getIntent().getExtras().getString("string")); 
+5
source

All Articles