我一直试图通过一项活动将意图传递给另一项活动。
//Create intent to send values to Menu//
Intent intent_to_Menu = new Intent(this, MenuActivity.class);
//get editText field values//
EditText first_edit_text = (EditText)findViewById(R.id.first_name);
first = first_edit_text.getText().toString();
intent_to_Menu.putExtra (FIRST_EXTRA,first);
EditText middle_edit_text = (EditText)findViewById(R.id.middle_name);
middle = middle_edit_text.getText().toString();
intent_to_Menu.putExtra (MIDDLE_EXTRA,middle);
startActivity(intent_to_Menu);
然后接收并显示其他活动:
Intent intent = getIntent();
first = intent.getStringExtra(VerifyActivity.FIRST_EXTRA);
middle = intent.getStringExtra(VerifyActivity.MIDDLE_EXTRA);
TextView firstTV = (TextView) findViewById(R.id.textView1);
firstTV.setText(first);
TextView lastTV = (TextView) findViewById(R.id.textView2);
lastTV.setText(last);
此时两个文本视图都显示相同的值。 谁能看到我做错了什么?