Can I start a second activity with an intent received in the first activity without getParcelableExtra?

huangapple go评论68阅读模式
英文:

Can I start a second activity with an intent received in the first activity without getParcelableExtra?

问题

可以这样做:

Can I start a second activity with an intent received in the first activity without getParcelableExtra?

但是不需硬编码值 "someData",而是在 FirstActivity 中接收一个 Intent,然后将带有接收到的值的该 Intent 传递到另一个名为 "SomeActivity" 的活动中。

就像这样:

String i1 = getIntent().getStringExtra("Zorrupia");

adb shell am start -n "com.adon.cors/.MainActivity" -e Zorrupia "ComemeLosPutosCojones"

然后能够检索在 FirstActivity 中收到的值 "ComemeLosPutosCojones" 并传递到第二个活动。

问候

英文:

It is possible to do this:

Can I start a second activity with an intent received in the first activity without getParcelableExtra?

But without hardcoding the value "someData", by receiving an Intent in the FirstActivity, then passing that intent with the value received to the other activity "SomeActivity".

Like this:

String i1 = getIntent().getStringExtra("Zorrupia");

adb shell am start -n "com.adon.cors/.MainActivity" -e Zorrupia "ComemeLosPutosCojones"

Then being able to retrieve this value "ComemeLosPutosCojones" you receive in the FirstActivity and passing the second one.

Regards

答案1

得分: 1

不,您应该为要发送到另一个活动的每个数据定义一个标签,因为您可能有不同的数据,它们在目标位置应该被正确识别。

英文:

No, you should define a tag for every data you want to send to another activity, because you may have different data and they should be recognized correctly in destination.

huangapple
  • 本文由 发表于 2020年9月6日 20:20:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/63764078.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定