Now the input text processing, with an array of strings to store every word,
Play button code below
ListString=TxtReader. GetStringList (inputStream1);
String [] sentenceArray=String. ToArray (new String [0]).
SENTENCE=sentenceArray [r]. Split (" (? <=[\ n]) ");
For (int r=1; Rfor (int i=0; i String toSpeak=what [I] the toString ();
System. The out. Println (" to speak: "+ toSpeak);
MSpeech. Speak (toSpeak, TextToSpeech. QUEUE_ADD, null);//QUEUE_FLUSH not work
}
}
Consult the rewind, forward, repeat key code can be done with what method?
CodePudding user response:
XxLanguageService service; Play the sentences on the service managementNextBtn. SetOnClickListener (v - & gt; Speak (service. GetNext ());
RepeatBtn. SetOnClickListener (v - & gt; Speak (service. GetCur ());
.
CodePudding user response:
Thank Daniel for the idea of service management are not ripe, then solved by the following way, thanks again,
Private class ttsUtteranceListener extends UtteranceProgressListener {
@ Override
Public void onStart (String utteranceId) {
Curr + +;
System. The out. Println (" current sentence: "+ curr);
}
@ Override
Public void onDone (String utteranceId) {
}
@ Override
Public void one rror (String utteranceId) {
}
}