/documentation/tutorial/HelloWorldTTS.java

http://eyes-free.googlecode.com/ · Java · 24 lines · 18 code · 5 blank · 1 comment · 0 complexity · d32b164dc34fbb5a33479fef1d06fd4d MD5 · raw file

  1. package com.myttsproject.helloworld;
  2. import com.google.tts.TTS;
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. public class HelloWorldTTS extends Activity {
  6. private TTS myTts;
  7. /** Called when the activity is first created. */
  8. @Override
  9. public void onCreate(Bundle savedInstanceState) {
  10. super.onCreate(savedInstanceState);
  11. setContentView(R.layout.main);
  12. myTts = new TTS(this, ttsInitListener, true);
  13. }
  14. private TTS.InitListener ttsInitListener = new TTS.InitListener() {
  15. public void onInit(int version) {
  16. myTts.speak("Hello world", 0, null);
  17. }
  18. };
  19. }