Code example for TextToSpeech

Methods: setLanguage

0
    @Override 
    public void onInit(int status) {
        // Set a flag so that the TaskBackService knows that the Text-To-Speech 
        // engine has been initialized, and can now handle speaking requests. 
        if (status == TextToSpeech.SUCCESS) {
            mTts.setLanguage(Locale.US);
            mTextToSpeechInitialized = true;
        } 
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    @Override 
    public void onDestroy() { 
        super.onDestroy(); 
        if (mTextToSpeechInitialized) {
            mTts.shutdown();
        } 
    }