Code example for TextToSpeech

Methods: setLanguage

0
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == VOICE_DATA_INTEGRITY_CHECK) {
            if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
                Log.v(TAG, "Voice data check passed");
                if (mTts == null) {
                    mTts = new TextToSpeech(this, this);
                    mTts.setLanguage(Locale.getDefault());
                } 
            } else { 
                Log.v(TAG, "Voice data check failed");
                mEnableDemo = false;
                updateWidgetState(); 
            } 
        } 
    } 
 
 
    public boolean onPreferenceChange(Preference preference, Object objValue) {
        if (KEY_TTS_USE_DEFAULT.equals(preference.getKey())) {
            // "Use Defaults" 
            int value = (Boolean)objValue ? 1 : 0;