我正在创建一个循环警报,我希望它能够与调用它的 Activity
进行通信。我可以将 Intent
数据发送到 BroadcastReceiver
但在 BroadcastReceiver
运行时从 Activity
获取信息目前还不清楚。我需要 BroadcastReceiver
从调用它的 Activity
中轮询信息。
最佳答案
I am creating a recurring alarm, which I want to be able to communicate with the Activity that called it.
很可能“调用它的 Activity”不再存在,因为它已被销毁。
I need the BroadcastReceiver to poll information from the Activity that called it.
不,你不知道。您需要您的 Activity
和您的 BroadcastReceiver
来使用共享的持久数据模型,例如数据库或文件,可能通过静态数据成员进行缓存。
关于java - 实例化重复警报后如何从 BroadcastReceiver 与 Activity 通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7142007/