Can't use onDismiss() when using custom dialogs - Android

前端 未结 6 2327
抹茶落季
抹茶落季 2021-02-20 05:31

I\'m working on a little program, and I need to add a custom dialog that passes some info to the calling acitivity when it closes. I extended the dialog class, and when I try to

6条回答
  •  你的背包
    2021-02-20 06:15

    To add dialog inside CustomDialog class:

    public class MessageBoxDialog extends Dialog implements DialogInterface.OnDismissListener
    {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
             ...
             setOnDismissListener(this);
             ...
        }
    
        @Override
        public void onDismiss(DialogInterface dialogInterface) {
    
        }
    }
    

提交回复
热议问题