Журналы и тосты для преобразования текста в речь не отображаются

Я хочу иметь журналы и тосты, когда запускается и останавливается преобразование текста в речь, но при запуске кода журналы не отображаются. В начале onCreate есть журнал, и он работает, но не внутри Text To Speech.

/** Gives function to the Text to Speech feature **/
        textToSpeech = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
            @Override
            public void onInit(int i) {
                if (i == TextToSpeech.SUCCESS) {
                    /** Sets Language to English **/
                    int result = textToSpeech.setLanguage(Locale.ENGLISH);

                    /** Checks if Language is supported **/
                    if (result==TextToSpeech.LANG_MISSING_DATA||result==TextToSpeech.LANG_NOT_SUPPORTED) {
                        Log.i("TextToSpeech","Language Not Supported");
                    }

                    //TODO dosent work?
                    textToSpeech.setOnUtteranceProgressListener(new UtteranceProgressListener() {

                        /** Activates when the Text to Speech function has started **/
                        @Override
                        public void onStart(String utteranceId) {
                            /** Creates Log to show that Text To Speech has started **/
                            Log.i("Text To Speech", "onStart Activity_TextToSpeech_Page");
                        }

                        /** Activates when the Text to Speech function has finished **/
                        @Override
                        public void onDone(String utteranceId) {
                            /** Creates Log to show that Text To Speech has finished **/
                            Log.i("Text To Speech", "onDone Activity_TextToSpeech_Page");
                            Toast.makeText(getApplicationContext(),
                                    "Text to Speech has finished",
                                    Toast.LENGTH_SHORT).show(); /** Shows toast message when the Text to Speech has finished **/
                        }

                        /** Activates when there is an error in the Text to Speech **/
                        @Override
                        public void onError(String utteranceId) {
                            /** Creates Log to show that Text To Speech has an error **/
                            Log.i("Text To Speech", "onError Activity_TextToSpeech_Page");
                        }

                    });
                }
                /** Activates when the Text to Speech has failed **/
                else {
                    Toast.makeText(getApplicationContext(),
                            "Text to Speech has failed",
                            Toast.LENGTH_SHORT).show(); /** Shows toast message when the Text to Speech has failed **/
                }
            }
        });

Я также получаю эту ошибку в Logcat, с приложением все в порядке, и оно работает нормально (за исключением журнала и тоста), но, насколько я понимаю, это связано с проблемой, с которой я столкнулся.

E/InputDispatcher: channel '65d4961 helm.jessica.speechapp/helm.jessica.speechapp.Activity_TextToSpeech_Page (server)' ~ Channel is unrecoverably broken and will be disposed!

Activity_TextToSpeech_Page означает действие, в котором находится код преобразования текста в речь.


person Jessica Ann Helm    schedule 22.01.2021    source источник