Dismiss DatePickerDialog on pressing back button

后端 未结 8 1923
佛祖请我去吃肉
佛祖请我去吃肉 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条回答
  •  -上瘾入骨i
    2020-12-19 12:38

    use following method, which is called when user presses Back button. This method is of Activity.

    @Override
    public void onBackPressed() {
        // TODO Auto-generated method stub
        super.onBackPressed();
    
        dialog.dismiss();
    }
    

提交回复
热议问题