Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a Voice action button be added next to edittext in android

Tags:

android

Can we have an google voice action button next to edittext, so whenever the user wants to input something into edittext he just taps the button, speaks and gets into the edittext. Can we do something like that, rather that the user has to tap on the edittext to open up soft keyboard choose voice action button and then speak which gets printed on to edittext.

Looking forward to your reply.

thanks.

like image 979
Mukunda Avatar asked Aug 17 '12 09:08

Mukunda


1 Answers

Put this

    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice recognition Demo...");
    startActivityForResult(intent, REQUEST_CODE);

into your onClick() and let onActivityResult() fill in the result.

like image 146
Cdr. Powell Avatar answered Oct 25 '22 19:10

Cdr. Powell