Code example for TextToSpeech

Methods: playSilencespeak

0
private static void Speak(String sMessage, int intQueueType, int delay) {
    if (mTts == null || sMessage == null) return;
    sMessage = sMessage.trim();
    isSpeaking = true;
    if (delay > 0) {
        mTts.playSilence(delay, intQueueType, null);
        intQueueType = TextToSpeech.QUEUE_ADD;
    } 
    mTts.speak(sMessage, intQueueType, null);
} 
 
public static void Init(Context context) {
    mTts = new TextToSpeech(context, (OnInitListener) context);
    IntentFilter filter = new IntentFilter(TextToSpeech.ACTION_TTS_QUEUE_PROCESSING_COMPLETED);
    context.registerReceiver(receiver, filter);
} 
 
public static void Shutdown() { 
    if (mTts != null) {
        mTts.stop();
Connect your IDE to all the code out there  Get Codota for Java