美文网首页
Android 事件总线 框架

Android 事件总线 框架

作者: CoderBigBear | 来源:发表于2016-08-01 09:38 被阅读424次

    EventBus
    EventBus是一款针对Android优化的发布/订阅事件总线。主要功能是替代Intent,Handler,BroadCast在Fragment,Activity,Service,线程之间传递消息.
    优点是开销小,代码更优雅,以及将发送者和接收者解耦。

    https://github.com/greenrobot/EventBus

    OTTO
    是Square推出的库 , An enhanced Guava-based event bus with emphasis on Android support.(一个支持Android 上使用的 基于Guava项目的增强 事件总线)

    https://github.com/greenrobot/EventBus
    介绍:
    http://square.github.io/otto/
    使用:如果你在Android程序开发的过程中想要不同的组件之间进行有效的通信可以使用这个库。通过otto库可以降低程序之间的耦合性。
    场景:应用场景:通过Activity修改Fragment里面的数据,或者通过Fragment修改Activity里的数据,这种场景还是比较普遍的

    MailOtto
    MailOtto 做预加载的。它非常适合做预加载

    https://github.com/drakeet/MailOtto
    介绍:
    https://drakeet.me/mailotto-sample
    使用:懒事件的事件总线

    相关文章

      网友评论

          本文标题:Android 事件总线 框架

          本文链接:https://www.haomeiwen.com/subject/jrrojttx.html