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();
            }
        }
    }
相关文章
|
前端开发 JavaScript
介绍class创建的组件中this.state
一、class创建的组件中this.state示例 二、this.state的定义及注意事项
|
监控
Dispatch Source 应用
Dispatch Source 源是一个偏底层的函数集合,使用时CPU负荷非常小,尽量不占资源,开发过程中大多是配合定时器使用。
161 0
|
Java
【EventBus】Subscribe 注解分析 ( Subscribe 注解属性 | threadMode 线程模型 | POSTING | MAIN | MAIN_ORDERED | ASYNC)
【EventBus】Subscribe 注解分析 ( Subscribe 注解属性 | threadMode 线程模型 | POSTING | MAIN | MAIN_ORDERED | ASYNC)
648 0
|
JavaScript
说说 element 组件库 broadcast 与 dispatch
说说 element 组件库 broadcast 与 dispatch
225 0
|
前端开发
获取this.$store.dispatch的返回值
获取this.$store.dispatch的返回值
1003 0
|
JavaScript 前端开发
Circular view path [addKnowledge]: would dispatch back to the current handler URL
报错日志: {"timestamp":1526565246776,"status":500,"error":"Internal Server Error","exception":"javax.
3545 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.
12509 0
|
C#
使用C# (.NET Core) 实现观察者模式 (Observer Pattern) 并介绍 delegate 和 event
观察者模式 这里面综合了几本书的资料. 需求 有这么个项目:  需求是这样的: 一个气象站, 有三个传感器(温度, 湿度, 气压), 有一个WeatherData对象, 它能从气象站获得这三个数据.
1902 0