文字转语音代码错误
error in text to speech code
我正在按照本教程在我的应用程序中实现文本到语音的实现
http://www.androidhive.info/2012/01/android-text-to-speech-tutorial/
演讲被击中。请参考下图
添加代码后
After editing the code
更改以下代码行:-
TextToSpeech textSpeach = new TextToSpeech(this, this);
改为
TextToSpeech textSpeach = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
}
});
问题原因 :- 您在 TextToSpeech
的两个参数中都传递了上下文 this
因此出现了这个问题,其次这是 TextToSpeech
的监听器
我正在按照本教程在我的应用程序中实现文本到语音的实现
http://www.androidhive.info/2012/01/android-text-to-speech-tutorial/
演讲被击中。请参考下图
添加代码后
After editing the code
更改以下代码行:-
TextToSpeech textSpeach = new TextToSpeech(this, this);
改为
TextToSpeech textSpeach = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
}
});
问题原因 :- 您在 TextToSpeech
的两个参数中都传递了上下文 this
因此出现了这个问题,其次这是 TextToSpeech