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

前端 未结 6 2325
抹茶落季
抹茶落季 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:17

    If you are using custom dialog and can't dismiss it, try below code. It worked for me.

     new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
               dialog.dismiss();
            }
        }, 1500);
    

提交回复
热议问题