I used VoiceRecognition.java as a starting point for my app.  But
instead of having a button that when clicked calls
startVoiceRecognitionActivity() to fire a RecognizerIntent to start a
voice recognition activity, I called startVoiceRecognitionActivity
directly from onCreate().

I need to launch the app from a pc via "adb shell am start -a
android.intent.action.MAIN -n <my app> $1", and I need to launch the
app multiple times.  If the activity is already running, and I use the
adb command to launch the app, the view displays, but the speech
prompt does not display.

I noticed an issue related to this has been raised, but I don't know
if it's been resolved.
http://code.google.com/p/android/issues/detail?id=2914

So is it a focus issue?  The RecognizerIntent is getting fired, and
it's just not getting the focus?  What do I need to do to force it to
have the focus?

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Begin voice recognition
        startVoiceRecognitionActivity();

        // Inflate our UI from its XML layout description.
        setContentView(R.layout.voice_recognition);

        // List of recognized words
        mList = (ListView) findViewById(R.id.list);
    }

    private void startVoiceRecognitionActivity() {
        Intent intent= new
Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                        RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "What are you
looking for?");
        startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to