如何找到在Android的意图源?意图、Android

2023-09-12 23:38:55 作者:清水煮岁月

可能重复:   Android:如何得到一个意向的发送者?

有没有办法在Android的寻源活动而触发一个意图(在目标活动)?

该方案是我有两个活动A和B两个火的意图,称活动C. 活动C上显示基于其来源的额外信息。例如。如果电话来自一个那么C​​的意图用B的活性C上显示3 textviews(根据讲师是谁基本上更多信息)。解雇的情况下,只显示2而textviews

The scenario is I have two activities A and B. Both fire an intent to call activity C. Activity C displays extra information based on its source. Eg. If call comes from A then C displays only 2 textviews whereas in the case of intent fired by B the activity C displays 3 textviews (basically more information based on who is the caller).

要建立此我需要知道是谁开的意图调用C 。如何做到这一点?

To establish this I need to know who fired the intent calling C. How do I do this?

推荐答案

一个更好的方式来做到这一点是使用意向的额外参数传递给接收器。

A better way to do this would be to use Intent extras to pass parameters to the receiver.