I'm a newbie in android dev and this is my first time in stackoverflow.
Im currently developing a simple workout app for my Software Engineering subject and I implemented Text-to-Speech to read out the workout steps.
I have a button named "Play/Pause Audio"
This is my onclick listener:
speak.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(!tts.isSpeaking()) {
HashMap<String, String> params = new HashMap<String, String>();
params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "sampletext");
tts.speak(tv.getText().toString(), TextToSpeech.QUEUE_ADD, params);
} else {
tts.stop();
}
}
});
But when i try to pause it, it stops and restarts the process.
Is there a way to pause TTS?
Thank you so much!!