views:

26

answers:

1

In my android app I call the voice recognition in my onCreate method of my startup activity. I have made it a preference to start up with the voice control or not. However, the app takes about 5-7 seconds to load when voice recognition is on. When it is off, the app starts almost instantly. Below is sample code, I have added Free_Form, max_results 1, and a custom prompt to mine.

Intent intent = new Intent("android.speech.action.RECOGNIZE_SPEECH");  
startActivityForResult(intent, 0);

So really I have 2 questions:

Isn't the startActivity(intent) run in a separate thread?

Why would calling the normal android speech recognition take sooo long to load in my OnCreate method?

A: 

You probably don't wait to complete that process from onCreate, instead launch it so that the result will come back to a callback handler, or make a thread and launch it from there.

Chris Stratton
I will attempt to launch it in a separate thread and/or launch with callback handler implemented, and accept your answer if that works. Thanks!
__nv__