此代码对英语运行良好。但是,不要为印地语工作。请你帮助我好吗?感谢..
private void speach_text() {
if (textview2.toString().equals("1")) {
loc1 = "en";
loc2 = "en_EN";
}
if (textview2.toString().equals("2")) {
loc1 = "hi";
loc2 = "hi_IN";
}
final Locale locale = new Locale(lo1, lo2);
tts = new TextToSpeech(Mainactivity.this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = tts.setLanguage(locale);
tts.speak(textview1.getText().toString(),TextToSpeech.QUEUE_FLUSH, null);
} else {
}
}
});
}