我有很多活动和MainActivity,并有两个按钮(B1-B2)。在B1(活性1)将用户写同样的数据和完成后回到MainActivity 和B2(活性2)将得到(活性1)如何将活动中的任何数据发送到其他活动?
(活性1)
Intent i = new Intent(getApplicationContext(), Activity2.class);
i.putExtra("new_variable_name","value");
(活性2)所有的日期
Bundle extras = getIntent().getExtras();
if (extras != null) {
String value = extras.getString("new_variable_name");
}
此代码不适用于我!! ....任何解决!
http://stackoverflow.com/questions/4967740/transfer-data-from-one-activity-to -otherother-activity-using-intents http://stackoverflow.com/questions/18146614/how-to-send-string-from-one-activity-to-another –