安卓相当于NSNotificationCenter [英] Android equivalent to NSNotificationCenter

查看:142
本文介绍了安卓相当于NSNotificationCenter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个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

这篇关于安卓相当于NSNotificationCenter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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