Not getting RecognizerIntent result codes

by pac » Fri, 23 Apr 2010 01:18:44 GMT

Sponsored Links
 I want to get the RecognizerIntent result codes such as
RESULT_SERVER_ERROR because I want to distinguish between the cases
where the speech wasn't understood or no matches were found and the
cases where recognition didn't occur because of connection or server

When onActivityResult() executes, however, the result code is either
RESULT_OK or 0.  I never catch any of the various RecognizerIntent
result codes.  What do I need to do?

Here's my code:

  private void startVoiceRecognitionActivity() {
        Intent intent= new
        intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Say something!");
        startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);

    protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
        if (requestCode == VOICE_RECOGNITION_REQUEST_CODE &&
resultCode == RESULT_OK) {
              // do stuff
        else if (requestCode == VOICE_RECOGNITION_REQUEST_CODE &&
resultCode != RESULT_OK) {

                // Figure out the error
                String err = "";
                switch (resultCode) {
                case (RecognizerIntent.RESULT_AUDIO_ERROR):
                        err = "Audio error";
                case (RecognizerIntent.RESULT_CLIENT_ERROR):
                        err = "Client error";
                case (RecognizerIntent.RESULT_NETWORK_ERROR):
                        err = "Network error";
                case (RecognizerIntent.RESULT_NO_MATCH):
                        err = "No match";
                case (RecognizerIntent.RESULT_SERVER_ERROR):
                        err = "Server error";
        super.onActivityResult(requestCode, resultCode, data);


Other Threads

1. Hide Emulator Keyboard

Hello Felix,

You can easily change the default skin of the emulator to a skin which
does not have a keyboard at all.

This link will help you for this;



2. ListView and custom rows containing EditText

Hello everyone,
 I had problems today concerning ListView/ListAdapter... I'd like to
get an activity that is very similar to the "New contact" one in v0.9.
Basically a ListView, that is expandable by custom rows containing
EditText, RateBars, etc..
I tried by extending BaseAdapter's onView (the simple way by inflating
layout-xmls per row), which actually worked, but nevertheless, it
raised a couple of problems which I want to address here.

1. Whenever I "touch" an EditText and start typing, the focus jumps to
the respective EditText of the first row that has the same inflated
listitem-layout. Navigating with keys works.

2. Changing orientation of the device in emulator (Ctrl+F12) causes
the EditTexts to lose all changes made. Do I really need to save their
states manually?

3. How to get a row that sticks to the bottom (the two buttons in "New
contact")? It is apparently achieved by an additional row containing

So, are there any solutions around that I did not see yet? I had a
look at Mark Murphy's blog, and also some of the tutorials on

Thanks & Cheers,

3. Problem with basic Map application

4. getScale replacement for BaseAdapter in 0.9 beta?

5. Bug in Bitmap.compress when used on JPEGs?

6. How to use the mic for audio-input in android

7. REST + JSON Web Service Client