Android - can I pass a parameter when launch other

2019-04-28 08:07发布

How to pass a parameter to an application that I call from my Application?

1条回答
霸刀☆藐视天下
2楼-- · 2019-04-28 08:43

You're starting your other activity with an Intent. It should look similar to this code:

Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
startActivity(intent);

Then you can add a line of code to pass parameters (e.g. Strings):

intent.putExtras("key", "value");

Note: you should add this line before starting the activity ;)

查看更多
登录 后发表回答