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();
}
})
精彩评论