Code example for TextToSpeech

Methods: isLanguageAvailable, setLanguage, setOnUtteranceCompletedListener

0
    { 
      // TODO Auto-generated method stub 
      /* ¨Ï¥Î¬ü°ê®É°Ï¥Ø«e¤£¤ä´©¤¤¤å */ 
      Locale loc = new Locale("us", "", ""); 
      /* Àˬd¬O§_¤ä´©¿é¤Jªº®É°Ï */ 
      if (tts.isLanguageAvailable(loc) == TextToSpeech.LANG_AVAILABLE) 
      { 
        /* ³]©w»y¨¥ */ 
        tts.setLanguage(loc); 
      } 
      tts.setOnUtteranceCompletedListener(ttsUtteranceCompletedListener); 
    } 
  }; 
  private TextToSpeech.OnUtteranceCompletedListener ttsUtteranceCompletedListener = new TextToSpeech.OnUtteranceCompletedListener()
  { 
    @Override 
    public void onUtteranceCompleted(String utteranceId) 
    { 
      // TODO Auto-generated method stub 
    } 
  };