You are missing the crash log. Please post it. However, most likely cause of the crash is that you're calling findViewById on the Activity's view hierarchy, but the views (typeWriter_openai and btn_yes) are actually part of the Dialog's layout, not the Activity's.
You need to call findViewById on the dialog, not on this (the activity):
TypeWriterView typeWriterView = dialogAI.findViewById(R.id.typeWriter_openai);
AppCompatButton appCompatButton = dialogAI.findViewById(R.id.btn_yes);