Dismiss DatePickerDialog on pressing back button

后端 未结 8 1949
佛祖请我去吃肉
佛祖请我去吃肉 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:43

    You could try include this in your alertDialog

    If you cancel the dialog, mEdit will return as empty. mEdit.setText("");

     AlertDialog alertDialog;
    
        alertDialog.setOnCancelListener(new OnCancelListener() 
        {                   
               @Override
                public void onCancel(DialogInterface dialog) 
                 {
                   // TODO Auto-generated method stub
                        mEdit.setText(""); 
                        dialog.dismiss();                           
    
                }
    });
    

提交回复
热议问题