Home > android text > android texttospeech oninit error

Android Texttospeech Oninit Error

Contents

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies android tts not working of this site About Us Learn more about Stack Overflow the company oninit method in android Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges android text to speech speak not working Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

Oninitlistener Android

Sign up Android TTS doesn't speak up vote 1 down vote favorite 1 I am trying to implement text to speech technology of android in my Activity but I face a strange error. I can't hear any sound, from my code. The speak method works only if I place it in onInit method, else it doesn't speak. My code is as follows speak failed: not bound to tts engine : public class GameOverActivity extends Activity implements OnInitListener { private TextToSpeech talker; .... talker = new TextToSpeech(this, this); say("Something",false); ... public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { talker.setLanguage(Locale.US); } else if (status == TextToSpeech.ERROR) { Toast.makeText(this,"Error occurred while initializing Text-To-Speech engine", Toast.LENGTH_LONG).show(); } void say(String text, boolean flush) { if(flush == true) { talker.speak(text,TextToSpeech.QUEUE_FLUSH,null); } if(flush == false) { talker.speak(text,TextToSpeech.QUEUE_ADD,null); } } The strange thing is that if I place the say method in onInit, it works fine! I watched logcat carefully and here are the results : TtsService.OnCreate () TTs is loading AudioTrack started TTSService.setLanguage loaded en-US succusfully setting speech rate to 100 and then nothing happens. Any idea about what is wrong with the above code? Thanks in advance! android text-to-speech google-text-to-speech share|improve this question edited Aug 20 at 11:04 onexf 392115 asked Mar 12 '12 at 13:47 Nick 444516 what's the value of flush when say initiates? –Brian Mar 12 '12 at 13:50 It doesn't make any diference if make it true or false –Nick Mar 12 '12 at 14:04 add a comment| 4

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss android text to speech example the workings and policies of this site About Us Learn more about

How To Use Android Text To Speech

Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each http://stackoverflow.com/questions/9668224/android-tts-doesnt-speak other. Join them; it only takes a minute: Sign up Why does Text To Speech (TTS) not work all the time? up vote 1 down vote favorite I cannot figure out why TTS does not work consistently. I would like some insight on how to improve my current setup. The application begins with TTS, welcoming the user or prompting http://stackoverflow.com/questions/22179148/why-does-text-to-speech-tts-not-work-all-the-time the user to say a voice command. So in onCreate I simply have the following: textToSpeech = new TextToSpeech(TTSActivity.this, this); My TTSActivity class implemetns OnInitListener, so I also have the following override method: @Override public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { textToSpeech.setOnUtteranceProgressListener(new UtteranceProgressListener() { @Override public void onStart(String utteranceId) { // TODO Auto-generated method stub } @Override public void onError(String utteranceId) { // TODO Auto-generated method stub } @Override public void onDone(String utteranceId) { //do some work here } }); textToSpeech.setLanguage(Locale.US); map.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "UniqueID"); ttsString(0); } else if (status == TextToSpeech.ERROR){ //try to restart TTS textToSpeech = new TextToSpeech(TTSActivity.this, this); ttsString(0); } } //end onInit() method Some explanations: The textToSpeech.setOnUtteranceProgressListener() is there so that I can activate voice recognition once TTS engine has stopped speaking. map is from HashMap map = new HashMap() and ttsString are all the strings I want the TTS to speak. So my ttsString(id#) method looks like the following. Before I make TTS speak, I call ttsString(id#) to set the string. private void ttsString(int id) { s

android.content.Context android.widget.Toast android.os.Bundle android.speech.tts.TextToSpeech.OnInitListener android.view.View android.content.Intent Frequently Used Methods SUCCESS LANG_MISSING_DATA LANG_NOT_SUPPORTED OnInitListener ( http://www.programcreek.com/java-api-examples/index.php?api=android.speech.tts.TextToSpeech ) ERROR speak ( ) setLanguage ( ) LANG_AVAILABLE shutdown https://code.tutsplus.com/tutorials/android-sdk-using-the-text-to-speech-engine--mobile-8540 ( ) stop ( ) LANG_COUNTRY_VAR_AVAILABLE setOnUtteranceCompletedListener ( ) LANG_COUNTRY_AVAILABLE setOnUtteranceProgressListener ( ) Java Code Examples for android.speech.tts.TextToSpeech The following are top voted examples for showing how to use android.speech.tts.TextToSpeech. These examples are extracted from open source projects. You can vote android text up the examples you like and your votes will be used in our system to product more good examples. + Save this class to your library Example 1 Project: AndroidLibraryProject File: Text2Speech.java View source code 6 votes @Override public void onInit(int status){ // Check if Text to speech engine has been android text to successfully instantiated if(status ==TextToSpeech.SUCCESS){ Log.d("Text2Speech","initialisation Succesful"); } else{ Log.d("TTS","Initialisation failed"); } } Example 2 Project: AndroidLibraryProject File: Text2Speech.java View source code 6 votes @Override public int onStartCommand(Intent intent,int flags, int startId){ try{ //Bundle extras=intent.getExtras(); //Get the language in which to speak language=(Locale)getLanguage();//extras.get("Language"); // Change here 28.10.14 //Sets the language int result=ttsObj.setLanguage(language); //Checks if language data is missing or language is not supported if(result==TextToSpeech.LANG_MISSING_DATA || result==TextToSpeech.LANG_NOT_SUPPORTED){ Log.d("TTS","Language not supported"); } else{ Log.d("TTS","Language supported"); } //if(ttsObj!=null && extras!=null){ change here 28.10.14 if(ttsObj!=null){ //String from=(String)extras.get("From");// Change here if(message!=null) { ttsObj.speak(message, TextToSpeech.QUEUE_ADD, null); // Changed from to message Log.d("onStart","Inside it"); } else { Log.d("onStart", "Message is null"); } } } catch(Exception e) { e.printStackTrace(); } return START_STICKY; } Example 3 Project: DemoProject File: ClockBackService.java View source code 6 votes @Override public void handleMessage(Message message) { switch (message.what) { case MESSAGE_SPEAK: String utterance = (String) message.obj; mTts.speak(utterance, QUEUING_MODE_INTERRUPT, null); return; case MESSAGE_STOP_SPEAK: mTts.stop(); return; case MESSAGE_STAR

& Motion GraphicsBundleseBooksDesign & IllustrationCodeWeb DesignPhoto & VideoBusinessMusic & Audio3D & Motion GraphicsPricingEnvato MarketEnvato StudioCommunityHelpEnvato MarketEnvato StudioCommunityForumHelpFree 10-Day TrialSign InHow-To TutorialsDesign & IllustrationAdobe PhotoshopVectorAdobe IllustratorIllustrationTools & TipsInspirationGraphic DesignNewsIcon DesignDrawingMore Categories...Learning GuidesCodeWeb DevelopmentWordPressMobile DevelopmentPHPJavaScriptFlashCMSiOS SDKNewsAndroid SDKMore Categories...Learning GuidesWeb DesignCSSHTML & CSSHTMLAdobe PhotoshopUI DesignComplete WebsitesWorkflowDesign TheoryJavaScriptCMSMore Categories...Learning GuidesPhoto & VideoShootingPost-ProcessingAdobe PhotoshopPhoto CritiqueHow-ToPhotographyLightingVideoInspirationAdobe LightroomMore Categories...Learning GuidesBusinessMarketingFreelancePlanningHow-ToCommunicationCareersBusinessSalesFinanceEntrepreneurshipMore Categories...Learning GuidesMusic & AudioAudio ProductionGeneralLogic ProWorkshopsMixing & MasteringSound DesignOpen MicAbleton LiveReasonRecordingMore Categories...Learning Guides3D & Motion GraphicsAdobe After Effects3DMotion Graphics3D Studio MaxMayaCinema 4DWorkflowNewsVisual EffectsRoundupsMore Categories...Learning GuidesGame DevelopmentGame DesignImplementationPlatform AgnosticBusinessProgrammingFlashFrom ScratchNewsHTML5UnityMore Categories...Learning GuidesComputer SkillsOS XApp TrainingProductivityTips & ShortcutsElectronicsAutomationSecurityOfficeHow-ToHardwareMore Categories...Learning GuidesCoursesDesign & IllustrationCodeWeb DesignPhoto & VideoBusinessMusic & Audio3D & Motion GraphicsBundlesComing SooneBooksDesign & IllustrationCodeWeb DesignPhoto & VideoBusinessMusic & Audio3D & Motion GraphicsPricingAdvertisementCodeAndroid SDKAndroid SDK: Using the Text to Speech EngineAdvertisementby Sue Smith15 Nov 2011Difficulty:IntermediateLength:MediumLanguages:EnglishAndroid SDKMobile DevelopmentThis tutorial will teach you to give your applications a voice with the Android SDK text to speech engine! The Android text to speech engine still seems to be a pretty underused resource in Android apps. However, implementing it in your own applications is straightforward. There are a few potential issues and choices you need to consider, but for most purposes, the process is not a complex one. In this tutorial we jump around a bit within one Android Activity, but don't worry, the complete code is listed at the end. The aim is to give you a clear idea of the what's going on at each processing stage so that you can successfully use the function in any app. Step 1: Start or Open

 

Related content

android text messaging error code 1

Android Text Messaging Error Code table id toc tbody tr td div id toctitle Contents div ul li a href Android Text Messaging App a li li a href Android Text Messaging App Like Iphone a li li a href Best Android Text Messaging App a li li a href Text Message Error Codes Prank a li ul td tr tbody table p enabled This tool uses JavaScript and much of it will not work correctly without it enabled Please turn JavaScript back on and reload this page Topics Android Discussions Please enter a title You can not relatedl post

android text message error code 1

Android Text Message Error Code table id toc tbody tr td div id toctitle Contents div ul li a href Android Text Message Memory Full a li li a href Android Text Message Not Sent a li li a href Android Text Message Symbols a li li a href Android Text Message Ringtone a li ul td tr tbody table p enabled This tool uses JavaScript and much of it will not work correctly without it enabled Please turn JavaScript back on and reload this page Topics Android Discussions Please enter a title You can not post a blank message

android text message error code 34

Android Text Message Error Code table id toc tbody tr td div id toctitle Contents div ul li a href Android Text Message Backup a li li a href Android Text Message Not Sent a li li a href Android Text Message Reply All a li li a href Android Text Message Ringtone a li ul td tr tbody table p Cases Covers Chargers Cables Docks relatedl Cradles Batteries Screen Protectors Reviews Apps Devices Help Q A android text message memory full The Best Root Deals Log in or Sign up Fewer ads and p h id Android Text Message

android text message error code 21

Android Text Message Error Code table id toc tbody tr td div id toctitle Contents div ul li a href Android Text Message Backup a li li a href Best Android Text Message App a li li a href Android Text Message Not Sent a li ul td tr tbody table p Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn relatedl more about Stack Overflow the company Business Learn more about hiring android text message memory

android text message error code 38

Android Text Message Error Code table id toc tbody tr td div id toctitle Contents div ul li a href Android Text Message Not Sent a li li a href Android Text Message Ringtone a li li a href Free Android Text Message Spy App a li ul td tr tbody table p Cases Covers Chargers Cables Docks Cradles Batteries Screen Protectors relatedl Reviews Apps Devices Help Q A The Best Root Deals android text message memory full Log in or Sign up Fewer ads and it's free Forums News Reviews android text message backup Apps Virtual Reality Help How