Code example for TextToSpeech

Methods: isLanguageAvailable, setLanguage, setOnUtteranceCompletedListener

0
    { 
      // TODO Auto-generated method stub 
      /* ʹ������ʱ��Ŀǰ��֧������ */ 
      Locale loc = new Locale("us", "", ""); 
      /* �����Ƿ�֧��������ʱ�� */ 
      if (tts.isLanguageAvailable(loc) == TextToSpeech.LANG_AVAILABLE) 
      { 
        /* �趨���� */ 
        tts.setLanguage(loc); 
      } 
      tts.setOnUtteranceCompletedListener(ttsUtteranceCompletedListener); 
      Log.i(TAG, "TextToSpeech.OnInitListener"); 
    } 
 
  }; 
  private TextToSpeech.OnUtteranceCompletedListener ttsUtteranceCompletedListener = new TextToSpeech.OnUtteranceCompletedListener()
  { 
    @Override 
    public void onUtteranceCompleted(String utteranceId) 
    { 
      // TODO Auto-generated method stub