title: Android TTS doesn't speak
body: <p>I am trying to implement text to speech technology of android in my Activity but I face a strange error. I can't hear any sound, from my code. The speak method works only if I place it in onInit method, else it doesn't speak.</p>
  
  <p>My code is as follows :</p>
  
  <blockquote>
  <pre><code>public class GameOverActivity extends Activity implements OnInitListener {
  private TextToSpeech talker;
  ....
  talker = new TextToSpeech(this, this);  
  say("Something",false);
  ...
     public void onInit(int status) {  
          if (status == TextToSpeech.SUCCESS) {
            talker.setLanguage(Locale.US);
          }
          else if (status == TextToSpeech.ERROR) {
              Toast.makeText(this,"Error occurred while initializing Text-To-Speech engine", Toast.LENGTH_LONG).show();
          }
  
  void say(String text, boolean flush) {
           if(flush == true)
           {
          talker.speak(text,TextToSpeech.QUEUE_FLUSH,null);
           }
           if(flush == false)
           {
          talker.speak(text,TextToSpeech.QUEUE_ADD,null);
           }         
      }
  </code></pre>
  </blockquote>
  
  <p>The strange thing is that if I place the say method in onInit, it works fine! </p>
  
  <p>I watched logcat carefully and here are the results :</p>
  
  <p>TtsService.OnCreate ()
  TTs is loading
  AudioTrack started
  TTSService.setLanguage
  loaded en-US succusfully
  setting speech rate to 100</p>
  
  <p>and then nothing happens.</p>
  
  <p>Any idea about what is wrong with the above code?</p>
  
  <p>Thanks in advance!</p>