[英]Is it Possible to Pass Edittext Value from one activity to another activity without using Intent
Intent intent = new Intent(this, Page.class);
intent.putExtra("arg", getText);
startActivity(intent);
//second activity:
String passedArg = getIntent().getExtras().getString("arg");
enteredValue.setText(passedArg);
在不使用意圖的情況下從一項活動獲得另一項活動的價值....?? 我想在其他活動edittext中顯示edittext傳遞的數據但不使用意圖......? 請幫助我是否可能....??
有很多方法:事件總線、SharedPreferences、通過全局對象(應用程序類)、數據庫、簡單文件。 但為什么?
首先嘗試直接和可讀的風格。
如果您無法將要保存在 Intent 中的值捆綁在一起,則可以使用SharedPreferences 。 更多信息在這里
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.