我有很多活動和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 –