且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android_如何将Bundle发送到另一个活动?

更新时间:2023-01-08 08:12:37

只需将您的捆绑包放入您用来启动活动的意图中即可.

Just put your bundle in the intent you are using to launch the activity.

Intent mIntent = new Intent(this, ExampleActivitly.class);
Bundle bundle = new Bundle();
bundle.putString("key", value);
mIntent .putExtras(bundle);

在ExampleActivitly中 只需

In ExampleActivitly just do

Bundle bundle = getIntent().getExtras();
String key = bundle.getString("key")

希望它对您有用:)