0
我正在嘗試將用戶輸入值從第四個活動傳遞到第五個以及第六個活動。我已經使用意圖傳遞值。但現在當我運行該應用程序時,它會從按鈕單擊跳到第六個活動,跳過第五個活動。是因爲我已經同時使用了這兩種意圖?我如何修改代碼以避免這種情況?如何避免在使用多個意圖時跳過活動?
Fourth.java
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.fourth);
final EditText et;
final Button b;
et = (EditText) findViewById(R.id.editText1);
b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent(Fourth.this, Fifth.class);
intent.putExtra("thetext", et.getText().toString());
startActivity(intent);
Intent intentnew = new Intent(Fourth.this, Sixth.class);
intentnew.putExtra("thetext", et.getText().toString());
startActivity(intentnew);
}
}
}
保存共享prefrence中的數據並使用任何類似於10或100個活動的地方共享數據 – 2014-09-04 13:32:35