2013. 7. 25. 16:30
public class Text2SpeechTest extends Activity implementsOnInitListener {
02 
03   TextToSpeech talker;
04 
05    @Override
06    public void onCreate(Bundle savedInstanceState) {
07        super.onCreate(savedInstanceState);
08        setContentView(R.layout.main);
09        talker = new TextToSpeech(thisthis);
10    }
11 
12    public void say(String text2say){
13      talker.speak(text2say, TextToSpeech.QUEUE_FLUSH,null);
14    }
15 
16   @Override
17   public void onInit(int status) {
18      say("Hello World");
19 
20   }
21 
22   @Override
23   public void onDestroy() {
24      if (talker != null) {
25         talker.stop();
26         talker.shutdown();
27      }
28 
29      super.onDestroy();
30   }
31}




Posted by hoonihoon