美文网首页
Can not perform this action afte

Can not perform this action afte

作者: 小呀么小黄鸡 | 来源:发表于2023-07-19 13:37 被阅读0次

https://blog.csdn.net/aiynmimi/article/details/105586933
dialogFragment.showNow()->dialogFragment.showAllowingStateLoss

    open fun showAllowingStateLoss(manager: FragmentManager, tag: String?) {
        try {
            val dismissed = DialogFragment::class.java.getDeclaredField("mDismissed")
            dismissed.isAccessible = true
            dismissed[this] = false
        } catch (e: NoSuchFieldException) {
            e.printStackTrace()
        } catch (e: IllegalAccessException) {
            e.printStackTrace()
        }
        try {
            val shown = DialogFragment::class.java.getDeclaredField("mShownByMe")
            shown.isAccessible = true
            shown[this] = true
        } catch (e: NoSuchFieldException) {
            e.printStackTrace()
        } catch (e: IllegalAccessException) {
            e.printStackTrace()
        }
        val ft = manager.beginTransaction()
        ft.add(this, tag)
        ft.commitAllowingStateLoss()
    }

相关文章

网友评论

      本文标题:Can not perform this action afte

      本文链接:https://www.haomeiwen.com/subject/ojooudtx.html