更新时间:2023-01-23 23:27:22
您可能要考虑使用事件驱动的模型,例如GreenRobot.
You may want to consider using an Event driven model such as GreenRobot.
http://greenrobot.org/eventbus/
这将使您能够有效地处理您描述的情况.
This would allow you to efficiently handle the scenario you describe.
或者,您可以使用LocalBroadcastManager
在应用程序的不同部分之间进行通信.
Alternatively, you can use the LocalBroadcastManager
to communicate between different parts of your app.
例如,当您要显示对话框并在所有活动中处理该消息时,发送广播消息
e.g Send a broadcast message when you want to display a dialog and handle that message in all of your Activities