【发布时间】:2021-01-06 21:54:46
【问题描述】:
我尝试调用一个调用 getSupportFragmentManager() 的方法,但是我得到了:
IllegalStateException: FragmentManager has not been attached to a host.
广播接收器触发并且当前在 UI 中的活动中的方法触发如下,但我收到错误:
BottomSheet bottomSheet = new BottomSheet();
bottomSheet.show(getSupportFragmentManager(), "bottomButtons");
我要做的就是从服务中调用bottomSheet,我必须通过广播接收器来做,因为我无法从服务中调用getSupportFragmentManager!如何让工作表出现,由我的服务中的事件触发?
【问题讨论】:
标签: java android broadcastreceiver bottom-sheet fragmentmanager