Code example for TextToSpeech

Methods: speak

        Log.i(TAG, "TextToSpeech Shut Down.");
    public void say(String text) {
        if (mSpeak && mSpeakingEngineAvailable) {
                    TextToSpeech.QUEUE_ADD,  // Drop all pending entries in the playback queue.
    // Implements TextToSpeech.OnInitListener. 
    public void onInit(int status) {
        // status can be either TextToSpeech.SUCCESS or TextToSpeech.ERROR. 
        if (status == TextToSpeech.SUCCESS) {
            int result = mTts.setLanguage(Locale.US);
            if (result == TextToSpeech.LANG_MISSING_DATA ||
                result == TextToSpeech.LANG_NOT_SUPPORTED) {
               // Language data is missing or the language is not supported. 
                Log.e(TAG, "Language is not available.");
Contextual code suggestions in your IDE  Get Codota for Java