开发者

Kill Activity on Dialog Back Button

I have a dialog that pops up in my activity. I want it to f开发者_StackOverflow中文版inish the entire activity when the back button is pressed on the dialog. How would I do this?


set the onCancelListener for the dialog and call finish() when its called.

setOnCancelListener(new OnCancelListener() 
{
    @Override
    public void onCancel(DialogInterface dialog) {
      removeDialog(DIALOG_ALERT);
      finish();
    }
})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜