Code example for TextToSpeech

Methods: getFeaturesgetLanguage

0
        } 
        return null; 
    } 
 
    private boolean isNetworkRequiredForSynthesis() { 
        Set<String> features = mTts.getFeatures(mTts.getLanguage());
        return features.contains(TextToSpeech.Engine.KEY_FEATURE_NETWORK_SYNTHESIS) &&
                !features.contains(TextToSpeech.Engine.KEY_FEATURE_EMBEDDED_SYNTHESIS);
    } 
 
    private void onSampleTextReceived(int resultCode, Intent data) {
        String sample = getDefaultSampleString();
 
        if (resultCode == TextToSpeech.LANG_AVAILABLE && data != null) {
            if (data != null && data.getStringExtra("sampleText") != null) {
                sample = data.getStringExtra("sampleText");
            } 
            if (DBG) Log.d(TAG, "Got sample text: " + sample);
        } else { 
            if (DBG) Log.d(TAG, "Using default sample text :" + sample);