I am using TextToSpeak in one of my app. While adding the speech string to the TextToSpeech Object Instance, It doesn't produce any sound. Though I am not getting any error in the log but still sound is not coming out. I want the device to speak as the value of a textview gets Set by resultMSG.setText() method.
public class ResultActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState){
............
resultMSG.setText(resultMSG_STR);
textToSpeech = new TextToSpeech(getApplicationContext(),newTextToSpeech.OnInitListener(){
@Override
public void onInit(int status) {
System.out.println("Txt To Speech STATUS = "+status);
System.out.println("Txt To Speech Error STATUS = "+TextToSpeech.ERROR);
System.out.println("Txt To Speech Success STATUS = "+TextToSpeech.SUCCESS);
if(status == TextToSpeech.SUCCESS){
textToSpeech.setLanguage(Locale.ENGLISH);
}
}
});
textToSpeechResult = textToSpeech.speak(resultMSG_STR,TextToSpeech.QUEUE_ADD,null);
}
}