Comments (10)
你说的是正确的,只不过这部分逻辑我没有写出来,这部分是需要加在demo里的,只不过我还没有抽出时间来写demo
from androidbaseframemvvm.
还有就是EventBus注册和解除注册时是不是加一个
EventBus.getDefault().isRegistered(subscriber)
判断一下好一点
from androidbaseframemvvm.
你可以具体说一下为什么要加这个判断的考虑吗?
from androidbaseframemvvm.
我是结合Navigation使用,Fragment在跳转时(跳回),会报EventBus重复注册这个错误
from androidbaseframemvvm.
Navigation我没有用过,了解过一些,刚刚我去百度了一下,在启动另一个fragment 时,上一个应该是会被销毁掉的,所以会不会是没有及时取消注册eventBus你才出现了那种情况。目前不用Navigation的情况下是没有问题的,而且如果以后框架上要支持Navigation的话,我也会全面的去优化的。
from androidbaseframemvvm.
BaseFrameFragment解绑是放在onDestroy里,我试了一下放在onStop里好像也不行,EventBus还会内存泄漏
from androidbaseframemvvm.
你说的是结合Navigation使用吗
from androidbaseframemvvm.
是的
from androidbaseframemvvm.
因为我没有深入使用过Navigation,并且框架也没有对Navigation进行支持,所以你的问题我可能暂时解答不了,但是我觉得可以从Navigation启动或者返回退栈fragment时的生命周期状态,进行注册和解除注册的处理,希望可以帮到你
from androidbaseframemvvm.
好的
from androidbaseframemvvm.
Related Issues (20)
- 大佬能不能出个详细的文档? HOT 6
- 大佬 操我 HOT 2
- 使用模块运行模式时依赖HiltAndroidApp HOT 2
- 关于kotlin方法注释无法自动生成params 和 return HOT 1
- demo翻译闪退 HOT 1
- retrofit在请求时,有没有好的添加loading弹窗的方案 HOT 2
- 收集建议的 issue HOT 30
- 发起请求的域名放哪里呢 HOT 3
- 异常处理的时候建议把异常类型提到ResponseException HOT 1
- initRequestData可以在baseactivity给一个空方法,需要的就去实现 HOT 2
- 单个组件运行不了 HOT 1
- 作者可以试试把base_module.gradle转成base_module.gradle.kts写吗?实在没研究出来 HOT 1
- java.lang.NullPointerException: null cannot be cast to non-null type androidx.fragment.app.Fragment HOT 1
- ViewBinding初始化失败 HOT 9
- Caused by: java.lang.InstantiationException: java.lang.Class<.ui.splash.SplashViewModel> has no zero argument constructor
- buildSrc HOT 6
- 有没有基于这个框架写的项目案例
- 看了兄弟的框架能否加一个联系方式 HOT 1
- ARouter初始化失败的问题 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androidbaseframemvvm.