Pulling info from edit text to another activity?
I have this EditText
field inside of one activity, and I want it so when I click the button attached to this field, the field gets pulled into another text field in a different activity. I am not really sure were to start on this. Any sug开发者_如何学Pythongestions?
Thanks for the help.
Inside ActivityA, when you wish to start another activity, you do:
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's onCreate() you do something like
// retrieve the text and show it in the TextView
textView.setText(getIntent().getExtras().getString("string"));
精彩评论