Close Android popup window with back press

后端 未结 8 2068
春和景丽
春和景丽 2021-01-05 02:42

I have created a android application where I have created a popup screen. But when I am pressing the back button, popup is not getting closed.

I have tried with onB

8条回答
  •  無奈伤痛
    2021-01-05 02:59

    The popup window normally closes when you press the back button. if you need to handle certain things when the popup closes, you can use

    popupWindow.setOnDismissListener
    

    Note:- I worked in kotlin. It worked for me

提交回复
热议问题