Sound is not coming out while implementing Text-to-speech in Android activity -
i using texttospeak in 1 of app. while adding speech string texttospeech object instance, doesn't produce sound. though not getting error in log still sound not coming out. want device speak value of textview gets set resultmsg.settext() method.
public class resultactivity extends activity { @override protected void oncreate(bundle savedinstancestate){ ............ resultmsg.settext(resultmsg_str); texttospeech = new texttospeech(getapplicationcontext(),newtexttospeech.oninitlistener(){ @override public void oninit(int status) { system.out.println("txt speech status = "+status); system.out.println("txt speech error status = "+texttospeech.error); system.out.println("txt speech success status = "+texttospeech.success); if(status == texttospeech.success){ texttospeech.setlanguage(locale.english); } } }); texttospeechresult = texttospeech.speak(resultmsg_str,texttospeech.queue_add,null); } }
check volume loud enough hear. may want install app play store verify tts working on phone.
you might want move code out of oncreate method , onresume method.
looking on own code, notice have "speak" call inside init callback. i'm thinking "speak" call getting called before tts initialized.
Comments
Post a Comment