今天有个定时任务之后打开一个dialog,当切到其他页面的时候,刚好定时任务结束showDialog报Can not perform this action after onSaveInstanceState,查了一下把dialog.show()方法换成getSupportFragmentManager().beginTransaction().add(dialog, "tag").commitAllowingStateLoss();就不会再报了。特此记录。
Can not perform this action after onSaveInstanceState的解决方法
最新推荐文章于 2024-07-31 17:16:18 发布
本文记录了一次遇到的问题:定时任务结束后尝试在Android中使用showDialog引发CannotPerformThisActionAfter onSaveInstanceState。通过将dialog.show()替换为add和commitAllowingStateLoss操作,解决了对话框在任务完成后正确显示的问题。
4854

被折叠的 条评论
为什么被折叠?



