Code example for AlertDialog

Methods: setOnDismissListener, show

0
                        public void onClick(DialogInterface dialog, int whichButton) {
                            doDeleteContact(contactUri);
                        } 
                    } 
                ) 
                .create(); 
 
        mDialog.setOnDismissListener(this);
        mDialog.show();
    } 
 
    @Override 
    public void onDismiss(DialogInterface dialog) {
        mActive = false;
        mDialog = null;
    } 
 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putBoolean(KEY_ACTIVE, mActive);