Giter Site home page Giter Site logo

Comments (10)

Quyunshuo avatar Quyunshuo commented on July 19, 2024

你说的是正确的,只不过这部分逻辑我没有写出来,这部分是需要加在demo里的,只不过我还没有抽出时间来写demo

from androidbaseframemvvm.

chesonsir avatar chesonsir commented on July 19, 2024

还有就是EventBus注册和解除注册时是不是加一个

EventBus.getDefault().isRegistered(subscriber)

判断一下好一点

from androidbaseframemvvm.

Quyunshuo avatar Quyunshuo commented on July 19, 2024

你可以具体说一下为什么要加这个判断的考虑吗?

from androidbaseframemvvm.

chesonsir avatar chesonsir commented on July 19, 2024

我是结合Navigation使用,Fragment在跳转时(跳回),会报EventBus重复注册这个错误

from androidbaseframemvvm.

Quyunshuo avatar Quyunshuo commented on July 19, 2024

Navigation我没有用过,了解过一些,刚刚我去百度了一下,在启动另一个fragment 时,上一个应该是会被销毁掉的,所以会不会是没有及时取消注册eventBus你才出现了那种情况。目前不用Navigation的情况下是没有问题的,而且如果以后框架上要支持Navigation的话,我也会全面的去优化的。

from androidbaseframemvvm.

chesonsir avatar chesonsir commented on July 19, 2024

BaseFrameFragment解绑是放在onDestroy里,我试了一下放在onStop里好像也不行,EventBus还会内存泄漏

from androidbaseframemvvm.

Quyunshuo avatar Quyunshuo commented on July 19, 2024

你说的是结合Navigation使用吗

from androidbaseframemvvm.

chesonsir avatar chesonsir commented on July 19, 2024

是的

from androidbaseframemvvm.

Quyunshuo avatar Quyunshuo commented on July 19, 2024

因为我没有深入使用过Navigation,并且框架也没有对Navigation进行支持,所以你的问题我可能暂时解答不了,但是我觉得可以从Navigation启动或者返回退栈fragment时的生命周期状态,进行注册和解除注册的处理,希望可以帮到你

from androidbaseframemvvm.

chesonsir avatar chesonsir commented on July 19, 2024

好的

from androidbaseframemvvm.

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.