How to handle Back button with in the dialog?

后端 未结 8 2304
无人共我
无人共我 2020-11-30 01:02

I am developing an application that when the button is pressed, it opens a dialog with OK and Cancel buttons.

It works fine.

When the user presses the back b

8条回答
  •  青春惊慌失措
    2020-11-30 01:19

    If you are using a DialogFragment, from what I can tell the right way to do it is to override onCancel()

    I noticed setOnCancelListener does not work, and setOnKeyListener works, but for me has the fun side effect that it swallows all keys if your dialog has an edit text.

提交回复
热议问题