android - Text to Speech from AppWidgetProvider -


is possible tts widget? same question has been asked before, no real answer has been given. start tts when widget pressed, , text. , how done?

yeah possible, first thing need implement "oninitlistener" in activity , write below code inside activity..

texttospeech talker; @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);     talker = new texttospeech(this, this); }  public void say(string text2say){     talker.speak(text2say, texttospeech.queue_flush, null); }  @override public void oninit(int status) {     say("hello world");  }  @override public void ondestroy() {     if (talker != null) {         talker.stop();         talker.shutdown();     }      super.ondestroy(); } 

for more follow this link


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -