Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.site_settings_format_dialog, null); TextView txtTitle = view.findViewById(R.id.text_title); TextView txtHelp = view.findViewById(R.id.text_help); mEditCustomFormat = view.findViewById(R.id.edit_custom); mRadioGroup = view.findViewById(R.id.radio_group); Bundle args = getArguments(); <START> FormatType formatType = (FormatType) args.getSerializable(KEY_FORMAT_TYPE); <END> mFormatValue = args.getString(KEY_FORMAT_VALUE); mEntries = formatType.getEntries(getActivity()); mValues = formatType.getValues(getActivity()); createRadioButtons(); boolean isCustomFormat = isCustomFormatValue(mFormatValue); mEditCustomFormat.setEnabled(isCustomFormat); if (isCustomFormat) { mEditCustomFormat.setText(mFormatValue); } @StringRes int titleRes = formatType == FormatType.DATE_FORMAT ? R.string.site_settings_date_format_title : R.string.site_settings_time_format_title; txtTitle.setText(titleRes); txtHelp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityLauncher.openUrlExternal(v.getContext(), Constants.URL_DATETIME_FORMAT_HELP); } }); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Calypso_AlertDialog); builder.setPositiveButton(android.R.string.ok, this); builder.setNegativeButton(R.string.cancel, this); builder.setView(view); return builder.create(); }</code><technical_language>happen, complains a NPE for usage of formatType this guarantee set here. do feel adding a fallback for that, below: if (formatType == null) { formatType = FormatType.DATE_FORMAT; } if used, happy. do think</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.site_settings_format_dialog, null); TextView txtTitle = view.findViewById(R.id.text_title); TextView txtHelp = view.findViewById(R.id.text_help); mEditCustomFormat = view.findViewById(R.id.edit_custom); mRadioGroup = view.findViewById(R.id.radio_group); Bundle args = getArguments(); FormatType formatType = (FormatType) args.getSerializable(KEY_FORMAT_TYPE); if (formatType == null) { formatType = FormatType.DATE_FORMAT; } mFormatValue = args.getString(KEY_FORMAT_VALUE); mEntries = formatType.getEntries(getActivity()); mValues = formatType.getValues(getActivity()); createRadioButtons(); boolean isCustomFormat = isCustomFormatValue(mFormatValue); mEditCustomFormat.setEnabled(isCustomFormat); if (isCustomFormat) { mEditCustomFormat.setText(mFormatValue); } @StringRes int titleRes = formatType == FormatType.DATE_FORMAT ? R.string.site_settings_date_format_title : R.string.site_settings_time_format_title; txtTitle.setText(titleRes); txtHelp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityLauncher.openUrlExternal(v.getContext(), Constants.URL_DATETIME_FORMAT_HELP); } }); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Calypso_AlertDialog); builder.setPositiveButton(android.R.string.ok, this); builder.setNegativeButton(R.string.cancel, this); builder.setView(view); return builder.create(); }