How to check if the current activity has a dialog in front?

后端 未结 8 1852
自闭症患者
自闭症患者 2021-02-05 09:37

I am using a third-party library and sometimes it pops up a dialog. Before I finish the current activity, I want to check whether there is a dialog popped up in the current con

8条回答
  •  生来不讨喜
    2021-02-05 10:22

    If you are using Kotlin just:

    supportFragmentManager.fragments.any { it is DialogFragment }
    

提交回复
热议问题