Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6848703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:54:05+00:00 2026-05-27T00:54:05+00:00

I’ve implemented the TextToSpeech integration exactly as mentioned in this blog post . After

  • 0

I’ve implemented the TextToSpeech integration exactly as mentioned in this blog post. After I’ve added it to my program it’s now interfering with my other intents.

For example:

  1. List item
  2. User starts app
  3. User invokes load activity
  4. User picks a file to load, and activity returns fileanme to load in the intent
  5. Main activity starts, and realizes it needs to load a filename so it starts doing so
  6. The check for TTS needs to be done so I launch the ACTION_CHECK_TTS_DATA intent
  7. This pauses the main activity again and the loading process gets interrupted
  8. When the TTS check returns, the loading never happened.

When do I need this TTS check? Can I just do it once on application start up? It’s causing my application to load slowly. I would like this load to be performed in a separate thread if possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:54:06+00:00Added an answer on May 27, 2026 at 12:54 am

    Do the check once. Once the data is installed, it’s very unlikely that the user will need to ever do it again. Once the data is installed, there’s no way for the user to delete it, even if they wanted to.

    Also, don’t use the ACTION_CHECK_TTS_DATA Intent, that’s awkward to use.

    Instead, do the following:

    1. Create TextToSpeech
    2. OnInit, check isLanguageAvailable()
      if it is, your app is all set.
      if not, send the ACTION_INSTALL_TTS_DATA

    Here’s some code that initializes a TextToSpeech in the way I suggest. As a bonus, it sets the language as well.

    public class DemoCreateTTS
    {
        private static final String TAG = "DemoCreateTTS";
    
        private TextToSpeech tts;
    
        public void createTextToSpeech(final Context context, 
                final Locale locale)
        {
            tts = new TextToSpeech(context, new OnInitListener()
            {
                @Override
                public void onInit(int status)
                {
                    if (status == TextToSpeech.SUCCESS)
                    {
                        Locale defaultOrPassedIn = locale;
                        if (locale == null)
                        {
                            defaultOrPassedIn = Locale.getDefault();
                        }
                        // check if language is available
                        switch (tts.isLanguageAvailable(defaultOrPassedIn))
                        {
                            case TextToSpeech.LANG_AVAILABLE:
                            case TextToSpeech.LANG_COUNTRY_AVAILABLE:
                            case TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE:
                                Log.d(TAG, "SUPPORTED");
                                tts.setLanguage(locale);
                                //pass the tts back to the main
                                //activity for use
                                break;
                            case TextToSpeech.LANG_MISSING_DATA:
                                Log.d(TAG, "MISSING_DATA");
                                    Log.d(TAG, "require data...");
                                    Intent installIntent = new Intent();
                                    installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
                                    context.startActivity(installIntent);
                                break;
                            case TextToSpeech.LANG_NOT_SUPPORTED:
                                Log.d(TAG, "NOT SUPPORTED");
                                break;
                        }
                    }
                }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.