我在android studio中将文本转换为语音时出错。我已经初始化了代码,但它仍然没有返回语音输出。代码如下。
else if((match.contains("yes") || match.contains("yeah")) && defsele) {
//Toast toast = Toast.makeText(getApplicationContext(), "Default selection is done and program is starting", Toast.LENGTH_SHORT);
//toast.show();
defsele=false;
switch (progno) {
case 1:
//Toast toast1 = Toast.makeText(getApplicationContext(),"The default settings for cotton cycle is done",Toast.LENGTH_SHORT);
//toast1.show();
String cotton = "The cotton program is starting with the default values";
tts.speak(cotton, TextToSpeech.QUEUE_FLUSH, null);
soak=true;
soakdef();
break;
tts.speak被删除并且不起作用。我该如何工作。初始化代码如下
tts = new TextToSpeech(this,this);
@Override
public void onInit(int status) {
Log.d("Speech", "OnInit - Status ["+status+"]");
if(status == TextToSpeech.SUCCESS){
Log.d("Speech","Success");
tts.setLanguage(Locale.ENGLISH);
我对Android编程非常陌生,非常感谢任何帮助。
先谢谢!!!