EventBus: Could not dispatch event: class com.********.LoginEvent to subscribing class

简介: Could not dispatch event04-18 14:10:11.062 4790-4790/com. E/EventBus: Could not dispatch event: class com.

Could not dispatch event

04-18 14:10:11.062 4790-4790/com. E/EventBus: Could not dispatch event: class com..LoginEvent to subscribing class class .**.FragmentMy
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1842)

switch Fragment



    public void switchFrag(Fragment from, Fragment to){
        if (this.frag != to){
            this.frag = to;
            FragmentTransaction ft = fm.beginTransaction();
            if(!to.isAdded()){
                ft.hide(from).add(R.id.frag_container,to).commit();
            }else {
                ft.hide(from).show(to).commit;
            }
        }
    }

commit() —> commitAllowingStateLoss()


    public void switchFrag(Fragment from, Fragment to){
        if (this.frag != to){
            this.frag = to;
            FragmentTransaction ft = fm.beginTransaction();
            if(!to.isAdded()){
                ft.hide(from).add(R.id.frag_container,to).commitAllowingStateLoss();
            }else {
                ft.hide(from).show(to).commitAllowingStateLoss();
            }
        }
    }
相关文章
|
5月前
使用EventBus 3.0 报 Subscriber class com.example.test.MainActivity and its super classes have no public methods with the @Subscribe annotation
使用EventBus 3.0 报 Subscriber class com.example.test.MainActivity and its super classes have no public methods with the @Subscribe annotation
89 5
|
API Windows
ASIO的post和dispatch方法
ASIO的post和dispatch方法的实现和差别
1376 0
|
监控
Dispatch Source 应用
Dispatch Source 源是一个偏底层的函数集合,使用时CPU负荷非常小,尽量不占资源,开发过程中大多是配合定时器使用。
190 0
|
JavaScript
说说 element 组件库 broadcast 与 dispatch
说说 element 组件库 broadcast 与 dispatch
265 0
|
前端开发
获取this.$store.dispatch的返回值
获取this.$store.dispatch的返回值
1052 0
|
JavaScript 前端开发
Could not resolve view with name 'xxx' in servlet with name dispatcherServlet
版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.csdn.net/testcs_dn/article/details/80336983 ...
7495 0
Circular view path [addKnowledge]: would dispatch back to the current handler URL
报错日志: {"timestamp":1526565246776,"status":500,"error":"Internal Server Error","exception":"javax.
3571 0
|
Kotlin 容器
EventBus3.1.1 解决 Caused by: org.greenrobot.eventbus.EventBusException: Subscriber class ... and its super classes have no public methods with the @Sub
      小菜今天自己写测试 Demo 时,需要用到 EventBus,目前集成 3.1.1 版本,集成的方式很简单,在某个 Fragment 实践应用中,却一直报入下错: Caused by: org.
12762 0
|
Java 索引 Spring
Circular view path xxx would dispatch back to the current handler URL
版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.csdn.net/testcs_dn/article/details/79700275 ...
5464 0