Any body help me to Provide hint in Text to Speech?
I get word in Array but TextToSpeech.QUEUE_ADD
takes a few seconds to speak and makes bold word run speedily.
My Code is below :-(tts is a TextToSpeech
object)
String[] strArr = txtText.getText().toString().split(" ");
txtText.setText("");
for(int i=0;i<strArr.length;i++)
{
Log.d("","Value :- "+strArr[i]);
HashMap<String, String> myHashAlarm = new HashMap<String, String>();
myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_NOTIFICATION));
myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "test");
tts.speak(strArr[i], TextToSpeech.QUEUE_ADD,myHashAlarm);
txtText.append(Html.fromHtml("<b>" + strArr[i] + "</b>"+" "));
}
Also I can't Understand tts.speak
last parameter(myHashAlarm
). How does it work?
Thanks
来源:https://stackoverflow.com/questions/14701602/in-android-how-can-we-provide-hint-which-word-is-speaking-in-text-to-speech