Dismiss DatePickerDialog on pressing back button

后端 未结 8 1922
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-19 12:29

On my view I have a button which when pressed pops up a DatePickerDialog. The poppedup dialog has a \"Done\" button. When I press that button the selected date is populated

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 12:37

    It looks like there is a bug with Jelybean where the Cancel button isn't working(& hence the back button). This is discussed in Jelly Bean DatePickerDialog --- is there a way to cancel?

    David Cesarino, who reported the bug and workaround in the above post, posted his solution here and SO.

    cavega slightly modified the above solution to allow initialization of the date in the DatePickerDialog to something other than today's date. Code can be found here. I used his solution and got it to work.

提交回复
热议问题