Code example for DialogFragment

Methods: getDialogonDestroyView, getRetainInstance

0
        new AddAuthorTask(getActivity()).execute(mAuthorEditText.getText().toString());
    } 
 
    @Override 
    public void onDestroyView() { 
        if (getDialog() != null && getRetainInstance()) {
            getDialog().setDismissMessage(null);
        } 
        super.onDestroyView(); 
    } 
 
    @Override 
    public void onClick(DialogInterface dialog, int which) {
        if (which == Dialog.BUTTON_NEGATIVE) {
            dialog.dismiss();
        } 
    } 
} 
Experience pair programming with AI  Get Codota for Java