@Override
    public void onViewCreated(@NotNull final View view, final Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);


        mEditText = view.findViewById(R.id.note);
        String initialNote = getArguments().getString(ARGUMENT_INITIAL_NOTE);
        if (initialNote != null) {
            // add a new line when editing existing text, to avoid accidental overwriting of the last line
            if (StringUtils.isNotBlank(initialNote) && !initialNote.endsWith("\n")) {
                initialNote = initialNote + "\n";
            }
            mEditText.setText(initialNote);
            Dialogs.moveCursorToEnd(mEditText);
            getArguments().remove(ARGUMENT_INITIAL_NOTE);
        }
        mPreventCheckbox = view.findViewById(R.id.preventWaypointsFromNote);
        final boolean preventWaypointsFromNote = getArguments().getBoolean(ARGUMENT_INITIAL_PREVENT);
        mPreventCheckbox.setChecked(preventWaypointsFromNote);

        toolbar.setNavigationOnClickListener(v -> dismiss());
        toolbar.setTitle(R.string.cache_personal_note);
        onCreateOptionsMenu(toolbar.getMenu(), new MenuInflater(getContext()));
        toolbar.setOnMenuItemClickListener(item -> {
            if (item.getItemId() == R.id.menu_item_save) {
                ((EditNoteDialogListener) requireActivity()).onFinishEditNoteDialog(mEditText.getText().toString(), mPreventCheckbox.isChecked(), false);
            } else if (item.getItemId() == R.id.menu_item_save_and_upload) {
                ((EditNoteDialogListener) requireActivity()).onFinishEditNoteDialog(mEditText.getText().toString(), mPreventCheckbox.isChecked(), true);
            }
            dismiss();
            return true;
        });

        Keyboard.show(requireActivity(), mEditText);
    }
Create a new dialog to edit a note.
<em>This fragment must be inserted into an activity implementing the EditNoteDialogListener interface.</em>

@param initialNote the initial note to insert in the edit dialog
main/src/main/java/cgeo/geocaching/ui/dialog/EditNoteDialog.java