Giter Club home page Giter Club logo

Comments (8)

hehonghui avatar hehonghui commented on July 25, 2024

不需要调用unregister。你用在公司产品上吗?

From Meizu MX4

-------- Original message --------
Sender: Zijian Wang [email protected]
Time: Mon 6/1 18:02
To: bboyfeiyu/AndroidEventBus [email protected]
Subject: [AndroidEventBus] 1.04版本unregister()方法的问题 (#14)

我今天把AndroidEventBus升级到1.0.4,完后在处理一个fragment的时候,只要一切出这个fragment,再回来,所有的Subscriber就接收不到信息了,不切出就没事儿。

此时我是在onDestroy中调用unregister的,但我看这个方法过时,我就把它删除掉了,结果前面的问题就好了,怎么切换Fragment,也不会影响方法的调用了。

所以我想问的是,现在既然unregister过时了,以后应该用什么替代,还是就根本不用调用了?


Reply to this email directly or view it on GitHub:
#14

from androideventbus.

zijianwang90 avatar zijianwang90 commented on July 25, 2024

是啊,用在公司的产品上

from androideventbus.

wurensen avatar wurensen commented on July 25, 2024

经过测试,我注册放在fragment中,关闭界面再进入,上一次注册的订阅者还在,所以感觉还是需要调用unregister的,持有弱引用不代表注册的订阅者对象会被及时回收吧?

from androideventbus.

jiantao88 avatar jiantao88 commented on July 25, 2024

和楼上的同问,如何保证关闭界面后注册的订阅者能被回收?

from androideventbus.

wurensen avatar wurensen commented on July 25, 2024

我现在还是在界面销毁时显示调用unregister方法;而且突然觉得这个方法不应该废弃,因为可能有需求是需要在某种情况下注销的,而不一定是在界面销毁时。

from androideventbus.

ydcool avatar ydcool commented on July 25, 2024

确实,今天也遇到这个问题,使用fragment的时候要在onDetach里显式调用Unregister,否则按back键退出再启动app时会导致重复注册,事件同时响应多次

from androideventbus.

hehonghui avatar hehonghui commented on July 25, 2024

各位说的是个问题,有时间我再更新一下把unregister的deprecated去掉,并且修复一些问题。最近比较忙

from androideventbus.

hehonghui avatar hehonghui commented on July 25, 2024

@zijianwang90 @ydcool @wurensen 今天稍微处理了一下,各位可以帮测试一下。Sticky支持子类型、另外unregister去除了deprecated注解。

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.