如何找到在Android的意图源? [英] How to find Intent source in Android?

查看:98
本文介绍了如何找到在Android的意图源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  <一href="http://stackoverflow.com/questions/3304304/android-how-to-get-the-sender-of-an-intent">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.

这篇关于如何找到在Android的意图源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆