Reputation: 19
cname = contactname.getText().toString();
tts.speak("Reciepient name is " + cname, TextToSpeech.QUEUE_FLUSH, null);
Above code is working but below code does not speak the string value.
String ww = "Welcome";
tts.speak(ww, TextToSpeech.QUEUE_FLUSH, null);
Upvotes: 0
Views: 1627
Reputation: 1328
I had the same problem. I fixed in this way:
txt.setText("Hello"+" "+"World");
tts.speak(txt, TextToSpeech.QUEUE_FLUSH, null);
Upvotes: 0
Reputation: 6144
The TTS Engine can be temperamental, unless instead of null
you need to add a HashMap
which contains the utterance ID.
There are so many tutorials out there that show how to do this and even if your implementation doesn't require it right now, it's likely you'll need to know when the utterance is completed at some point in your future design.
The Android introduction is a good place to start.
Test different TTS engines, on different devices and OS versions - Many behave differently and expose problems that are not associated to your base code
Upvotes: 1