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