编辑
我现在有这个代码:
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.enter_name);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
EditText editText1 = (EditText) findViewById(R.id.enter_age);
String message1 = editText1.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message1);
EditText editText2 = (EditText) findViewById(R.id.enter_height);
String message2 = editText2.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message2);
EditText editText3 = (EditText) findViewById(R.id.enter_weight);
String message3 = editText3.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message3);
EditText editText4 = (EditText) findViewById(R.id.enter_gender);
String message4 = editText4.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message4);
startActivity(intent);
}
}
我将如何同时从所有这些窗口中提取信息?因为我想将其保存在用户配置文件中。目前这是我的代码,但我只收到来自“enter_gender”的信息。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the message from the intent
Intent intent = getIntent();
String message = intent.getStringExtra(NutritionHandler.EXTRA_MESSAGE);
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
// Set the text view as the activity layout
setContentView(textView);
}