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.
views:
71answers:
2
+1
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.
Andy Zhang
2010-07-21 22:23:56
+1
A:
Generally you don't need to know this. If the calling activity uses startActivityForResult(Intent, int)
, the callee can use setResult(int, Intent)
to specify an Intent to send back to the caller. The caller will receive this Intent in its onActivityResult(int, int, Intent)
method.
adamp
2010-07-22 02:59:28
The intent from `setResult` is only sent once the child Activity is closed. I would like to be able to arbitrarily send intents back to parent activity while child activity is operating.
zer0stimulus
2010-07-22 22:10:37