Equivalent of iOS NSNotificationCenter in Android?

前端 未结 5 720
无人共我
无人共我 2021-01-31 05:51

Is there an equivalent of the iOS class NSNotificationCenter in Android ? Are there any libraries or useful code available to me ?

5条回答
  •  一整个雨季
    2021-01-31 06:31

    Take a look at the Otto event bus from Square:

    http://square.github.com/otto/

    It has essentially the same features as NSNotificationCenter but thanks to annotations and static typing it is easier to follow the dependencies of components and paths that events follow. It's much simpler to use than the stock Android broadcast API, IMO.

提交回复
热议问题