Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.dialog_overwrite_project, null); inputLayout = view.findViewById(R.id.input); inputLayout.getEditText().setText(programName); radioGroup = view.findViewById(R.id.radio_group); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { switch (checkedId) { case R.id.replace: inputLayout.setVisibility(TextView.GONE); break; case R.id.rename: inputLayout.setVisibility(TextView.VISIBLE); break; } } }); <START> radioGroup.check(R.id.rename); <END> final AlertDialog alertDialog = new AlertDialog.Builder(getActivity()) .setView(view) .setTitle(R.string.overwrite_title) .setMessage(R.string.overwrite_text) .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ToastUtil.showError(getActivity(), R.string.notification_download_project_cancel); DownloadUtil.getInstance().downloadCanceled(url); } }) .create(); alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { Button buttonPositive = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); buttonPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (handlePositiveButtonClick()) { dismiss(); } } }); buttonPositive.setEnabled(!inputLayout.getEditText().getText().toString().isEmpty()); DialogInputWatcher inputWatcher = new DialogInputWatcher(inputLayout, buttonPositive, false); inputLayout.getEditText().addTextChangedListener(inputWatcher); } }); inputLayout.getEditText().setOnFocusChangeListener(new OpenSoftkeyboardRightAway(alertDialog)); return alertDialog; }</code><technical_language>default selection for RadioGroup changed layout resource [here](<LINK_0> rearrange sequence (if want rename replace) if want change default visibility of inputLayout well</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.dialog_overwrite_project, null); inputLayout = view.findViewById(R.id.input); inputLayout.getEditText().setText(programName); radioGroup = view.findViewById(R.id.radio_group); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { switch (checkedId) { case R.id.replace: inputLayout.setVisibility(TextView.GONE); break; case R.id.rename: inputLayout.setVisibility(TextView.VISIBLE); break; } } }); final AlertDialog alertDialog = new AlertDialog.Builder(getActivity()) .setView(view) .setTitle(R.string.overwrite_title) .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ToastUtil.showError(getActivity(), R.string.notification_download_project_cancel); DownloadUtil.getInstance().downloadCanceled(url); } }) .create(); alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { Button buttonPositive = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); buttonPositive.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (handlePositiveButtonClick()) { dismiss(); } } }); buttonPositive.setEnabled(!inputLayout.getEditText().getText().toString().isEmpty()); DialogInputWatcher inputWatcher = new DialogInputWatcher(inputLayout, buttonPositive, false); inputLayout.getEditText().addTextChangedListener(inputWatcher); } }); inputLayout.getEditText().setOnFocusChangeListener(new OpenSoftkeyboardRightAway(alertDialog)); return alertDialog; }