英文:
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:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论