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 8247861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:59:56+00:00 2026-06-07T22:59:56+00:00

In my Android application I use TTS and Voice Recognition. Despite using all the

  • 0

In my Android application I use TTS and Voice Recognition. Despite using all the available callbacks to understand the status they are in, I still get situations that I cannot handle. Examples:

1) TTS reports successful initialisation, but fails to speak (known issue for some custom TTS engines (mentioning no names)).

2) Network access is lost after initial successful connection, which can result in a huge amount of lag before a network error is returned.

There are other situations that I won’t bore you with.

I’ve read and digested time monitoring threads such as this and this so I understand how to accurately determine the time between X&Y, but it’s a monitoring method that I’m after, which I can react to when a set limit is reached.

Excuse my pseudo-code, but I hold my hands up, I’ve no idea where to begin on this..

    public boolean methodSuccess = false;

    public void troublesomeMethod() {
    if(// everything completed and I got a usual result) {
    methodSuccess = true;
    } 

    public boolean timeMonitor(int maxDuration) {

    // use System.currentTimeMillis() here as start value

    // monitor time elapsed here in loop
    // monitor methodSuccess in loop
    // return false if methodSuccess is set to true whilst in loop

    // break if maxDuration reached and return true

    }

Again, excuse the above code, I simply can’t think how to achieve this…

In addition, if I started the above with:

    boolean monitorThis = timeMonitor(5000); // let me know when 5 seconds have passed
    startTroublesomeMethod(); // the one I want to monitor

Then it would be pointless if I had to ‘wait’ on the boolean response being returned before startTroublesomeMethod() actually began! Or the troublesomeMethod began before I started monitoring it…

    if(monitorThis) {
    // react to lagging method by destroying TTS or Listener Object
    } else {
    // the troublesomeMethod behaved normally - do nothing
    }

I hope in my confusion I’ve managed to express what I’m trying to achieve.

I thank you in advance for your help.

  • 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-06-07T22:59:59+00:00Added an answer on June 7, 2026 at 10:59 pm

    You can use a Handler to post a delayed check. For example:

        Handler mHandler = new Handler();
        mHandler.postDelayed(new Runnable() {
            @Override public void run() {
                // You can set a flag or if you run your method 
                // on another thread, you can interrupt that thread. 
            }
        }, 5000);
    

    Keep in mind that the Handler is set to the same thread it was created in. If the method you are trying to monitor is running in the same thread, you may have problems. Call your method in another thread and keep a reference to that thread to interrupt it if necessary.

        Thread mThread = new Thread(new Runnable() {
            @Override public void run() {
                // Call your method here and keep a reference to this thread.
            }
        });
        mThread.run();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Android application I have to use common string value for all activities.
I am trying to use a .NET service in Android Application using the ksoap2
I have an Android application that makes use of TTS (Text to speech) API.
I would like all the buttons of my android application use the same background
I want to use TTS (Text to Speech) APIs in my android application.Now i
In my Android application I use the Graph API through the Android SDK. I
In my android application I use camera to capture photo. I want to print
I'm converting my Android application to use fragments. Previously, I had an activity that
I am developing an Android application which makes use of the Osmdroid maps api.
I am trying to design my first Android application with the use of GPS.

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.