安卓相当于NSNotificationCenterNSNotificationCenter

2023-09-04 07:45:50 作者:瑾七

在一个iPhone应用程序交给机器人移植的过程中,我寻找到应用程序中沟通的最佳方式。意图似乎是要走的路,这是最好的(唯一的)选择吗?似乎NSUserDefaults的重量轻得多,比意图做在性能和编码。

In the process of porting an iPhone application over to android, I am looking for the best way to communicate within the app. Intents seem to be the way to go, is this the best (only) option? NSUserDefaults seems much lighter weight than Intents do in both performance and coding.

我还要补充我有一个应用程序子类的状态,但我需要另一个活动了解事件。

I should also add I have an application subclass for state, but I need to make another activity aware of an event.

推荐答案

您可以试试这个:的 http://developer.android.com/reference/java/util/Observer.html

相关推荐