JeremyLiao / LiveEventBus

:mailbox_with_mail:EventBus for Android,消息总线,基于LiveData,具有生命周期感知能力,支持Sticky,支持AndroidX,支持跨进程,支持跨APP
Apache License 2.0
3.87k stars 529 forks source link

A,B都发送给C,A的正常,B的空指针,没有设置autoclear #77

Closed zhuoCreator closed 4 years ago

zhuoCreator commented 4 years ago

A,B页面的代码:AssetSerializableListBean serializableListBean = new AssetSerializableListBean(); serializableListBean.setList(assetDataList.getList()); LiveEventBus.get("asset_coin_list",AssetSerializableListBean.class).post(serializableListBean); ChangeActivity(InsertCoinActivity.class, false);

C页面的代码: LiveEventBus.get("asset_coin_list", AssetSerializableListBean.class).observeSticky(this, (@Nullable AssetSerializableListBean assetSerializableListBean) -> { if (assetSerializableListBean != null) { List list = assetSerializableListBean.getList();

            List<AssetListBean.DataBean.ListBean> collect = Stream.of(list).filter(a -> a.isIsrecharge() == true).collect(Collectors.toList());
            mList.addAll(collect);
        }
    });
zhuoCreator commented 4 years ago

A是fragment,B,C是activity ,我用eventbus 这样是可以用的