好的,这是我的代码:
final TextToSpeech ttv = new TextToSpeech(MainActivity.this, new TextToSpeech.OnInitListener() {
public void onInit(int status) {
ttv.setLanguage(Locale.US);
Log.e("Init", "Success");
ttvInit = true;
// wait a little for the initialization to complete
Handler h = new Handler();
h.postDelayed(new Runnable()
{
public void run() {
ttv.speak(textSpeech.getText().toString(),TextToSpeech.QUEUE_FLUSH,null);
}
}, 400);}
else {
System.out.println("Something went wrong.");
}
}
但我遇到了一个错误,提示“无法解析方法'postDelayed(java.lung.Runnable,int)'”
编辑: 现在它告诉我它是未使用的: http://www.igreklik.com/slike/viewer.php?file=75221279105193055086.png&file_imgur=HPjDlfa.png