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. Dalvik Turbo "up to three times" faster, all while reducing battery drai

Bagus untuk tukang sulap gw yang mulai tua....

Swiss firm claims huge boost in Android app performance, battery life with
new virtual machine
By Chris Ziegler <>
 posted Feb 9th 2010 6:35AM
the core of Anrdoid lies a little bundle of code known as the Dalvik virtual
machine, a runtime environment for Java apps that's specifically optimized
for hardware with limited memory and processor power -- you know, the kind
of situation you find in your average smartphone. The relative success of
the Android Market suggests that Dalvik's getting the job done on some level
(as long as you're not looking for a texture-intense FPS), but the fact that
Google bothered to create a separate native development
speed up intensive operations certainly serves as a damning counterpoint.
Enter Swiss firm Myriad -- a founding and code-contributing member of the
OHA <>, coincidentally -- which is touting
this week that it's crafted a much higher-performance replacement for
Dalvik, appropriately known as "Dalvik Turbo." Just how much
higher-performance are we talking? *Myriad claims apps run in Dalvik Turbo
"up to three times" faster, all while reducing battery drain and giving devs
the power they need to create graphically intense games*. Even better, it
apparently maintains complete compatibility with existing Android apps and
is available for all the key mobile platforms -- ARM, Atom, and MIPS
included -- and is virtually guaranteed to make you sob uncontrollably to
learn that your Android 1.5, 1.6, 2.0, or 2.1-based device isn't using it.
It'll be on display at MWC <> next week, so
we're looking forward to finally seeing Gang Wars humming along at 60fps on
a G1.

Sent by XPS via gmail

"Indonesian Android Community [id-android]" 

2. Window System Bug: phonewin...@decorview gets wrong Window size, width/height

1. Popup Dialog with ListView
2. Slide open, close, repeat, and do fast
3. Sometimes in Slide close state, the dialog is show in 320X320
window instead of the right 320X480



3. OOT: Paging ntil & suhu SA

4. Why setting TextView.Ellipsize as Marquee cause its sibling view in linearlayout redraw

5. pause

6. This Week's office hours

7. drawing children in custom linearlayout