Android - dismissDialog does not dismiss the dialog

前端 未结 8 1664
悲哀的现实
悲哀的现实 2020-12-08 01:49

I am using the showDialog() and dismissDialog() to show progress dialogs in my app. Moved from creating the dialog and calling show()

8条回答
  •  感动是毒
    2020-12-08 02:01

    I wasted over a day on a problem like this with dialogs not being dismissed when calling dismissDialog. It occurred after my first screen rotation and never worked afterwards. I had been using an external AsyncTask which was passed a referenced to the state explicitly.

    In the end the solution was really simple.... removeDialog(int) instead of dismissDialog(int).

    I had spent what felt like forever proving to myself I was doing the dismiss on the correct activity and checking the number of times things were called etc, but it was caused by some of the jiggerypokery behind the scenes.

提交回复
热议问题