I've been trying to write a speech output class by using Google TTS engine.
But all over the internet, I only find the examples with layout and using the TTS service in the MainActivity's onCreate
and other overridden methods.
I want to make a class that has a method like speakThis(String someText) which speaks out the passed string.
What you need is a Service, here's the one I use:
And when yo want to invoke it, you just:
Hope it helps!