什么是片段之间通信的最佳方式 [英] What is the best way to communication between fragments

查看:128
本文介绍了什么是片段之间通信的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个拿下3个不同片段的片段容器,我想通知3段之间的消息

I have a fragment container that holed 3 different fragments and i want to notify message between the 3 fragment

什么是做到这一点的最好方法是什么?

What is the best way to do it?

感谢

推荐答案

最简单的&放大器;最好的办法将是利用一些事件总线库。这将让您的code清洁和放大器;松散耦合的片段,活动之间的通信。

The simplest & best approach will be use of some event bus library. It will keep your code clean & loosely coupled communications between fragments,activities.

奥托是非常容易安装和放大器;使用。它是从sqaure。检查出来的@ http://square.github.io/otto/

Otto is extremely easy to setup & use. It is from sqaure. Check it out at @ http://square.github.io/otto/

http://corner.squareup.com/2012/07/otto.html 也会给你一睹它解决什么问题。

http://corner.squareup.com/2012/07/otto.html will also give you glimpse of what problem it solves.

这篇关于什么是片段之间通信的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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