如何得到一个意向的发送者? [英] How to get the sender of an Intent?
本文介绍了如何得到一个意向的发送者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法为活动
来找出谁(即类名)发送了意图
?我在寻找我的活动
通过发送一回给发送者响应收到的意图一个通用的方法,谁就可能。
Is there a way for an Activity
to find out who (i.e. class name) has sent an Intent
? I'm looking for a generic way for my Activity
to respond to a received intent by sending one back to the sender, whoever that may be.
推荐答案
有可能是另一种方式,但唯一的解决办法,我知道的是有活动一经 startActivityForResult调用活动B()
。然后活动B能够使用 getCallingActivity()
检索活动A的身份。
There may be another way, but the only solution I know of is having Activity A invoke Activity B via startActivityForResult()
. Then Activity B can use getCallingActivity()
to retrieve Activity A's identity.
这篇关于如何得到一个意向的发送者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文