1

在活动之间传递额外内容是行不通的。我尝试了所有我知道的方法。

Intent i = new Intent(getActivity(), SomethingMore.class);
i.putExtra(intentStart, 1);
i.putExtra(intentSomething, true);
startActivity(i);

Bundle extras = i.getExtras();
if (extras != null) {
    start = extras.getInt(intentStart);
    something = extras.getBoolean(intentSomething);
}

不起作用。我也试过用这种方法来检索

start = intent.getIntExtra(intentStart, 0);
something = intent.getBooleanExtra(intentSomething, false);

,这也不起作用。使用 aBundle也不起作用..

Intent i = new Intent(getActivity(), SomethingMore.class);
Bundle mBundle = new Bundle();
mBundle.putInt(intentStart, 1);
mBundle.putBoolean(intentSomething, true));
i.putExtras(mBundle);
startActivity(i);
4

1 回答 1

1

Intent Extra 键是否相同?;) (intentSomething 和 intentStart)

于 2012-12-16T01:52:57.387 回答