将两个包传递给两个不同的活动

时间:2012-07-18 20:47:10

标签: android bundle

我有一个Activty Voice,可以将两个不同的捆绑包发送到两个不同的活动中。

    Bundle a = new Bundle();
    a.putInt("key", counter_score);
    Intent sendtoA = new Intent(Voice.this, ActivityA.class);
    sendtoA.putExtras(a);
    startActivity(sendtoA);

    String correct_a = txView.getText().toString();
    Bundle basket_a = new Bundle();
    basket_a.putString("keya", correct_a);
    Intent putBasket_a = new Intent(Voice.this, ActivityFinal.class);
    putBasket_a.putExtras(basket_a);


 finish();

我在aActivityA上抓住了ActivityFinal捆绑{/ 1}}

Bundle got_a = getIntent().getExtras();
gota = got_a.getInt("key");

但是我无法检索basket_a

Bundle gotA = getIntent().getExtras();
gotLetterA = gotA.getString("keya");
txView.setText("Nice" + gotLetterA);

一个包正在传递,另一个正在传递一个字符串。

对于ActivityFinal上的gotA,结果显示为null ..

日Thnx

0 个答案:

没有答案