Giter Club home page Giter Club logo

Comments (6)

hehonghui avatar hehonghui commented on August 28, 2024

@maruiwhu 这种情况你需要自己通过内部状态来控制是否接收了消息了。

from androideventbus.

ASPOOK avatar ASPOOK commented on August 28, 2024

@maruiwhu 目前来看,EventBus不能很好地实现点对点或者叫一对一的通信,AndroidEventBus加了一个Tag,更进一步了,但仍无法适应各种情况,如一个Subscriber有多个对象实例的情况。EventBus本为了解耦,如果为每个post绑定Subscriber的话,又会增加耦合。在你的需求中,如果拿到数据后,你的post是在fragment中发出的,可以将Tag设为fragment对象的hashcode,这样ViewPager中的Fragment就能响应各自的数据请求了

from androideventbus.

wyfly28 avatar wyfly28 commented on August 28, 2024

我也碰到这样的问题,想让tag唯一,即把hashcode也加到tag字符串中,但是注解有限制必须是常量表达式,没法做到设置tag唯一。后来想了一个办法,在EventBus的源码里增加了一个手动注册事件的接口,这样就可以把tag+hashcode注册进去。@bboyfeiyu 不知道有没有更好的办法。。。

from androideventbus.

wrongch avatar wrongch commented on August 28, 2024

其实,Event对象里面可以添加一个标识, 在处理的时候, 做个if...else 判断就可以了。

from androideventbus.

wurensen avatar wurensen commented on August 28, 2024

通过封装event对象来放入区分的条件吧~

from androideventbus.

chengzhijun0706 avatar chengzhijun0706 commented on August 28, 2024

@wurensen 如何进行封装呢,我也遇到了相同的问题

from androideventbus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.