1

I calling new activity for result:

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

and SPEECH_RECOGNITION_REQUEST_CODE is defined the following way:

public static final int SPEECH_RECOGNITION_REQUEST_CODE = 4;

but on result I'm getting different value:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    //requestCode == 196608 + SPEECH_RECOGNITION_REQUEST_CODE
    ...
}

I tried with different values for SPEECH_RECOGNITION_REQUEST_CODE.

I'm using android.support.v4.

Ari
  • 3,101
  • 2
  • 27
  • 49
  • What value are you receiving for resultCode in onActivityResult? Your text is not clear. – Larry Schiefer Feb 24 '14 at 11:27
  • @LarrySchiefer I'm getting result, i.e. RESULT_OK. How does it matter? I'm getting different `reqestCode` to one I'm providing in `startActivityForResult`. – Ari Feb 24 '14 at 11:29
  • The `resultCode` and `data` (Intent) are the result coming from the `Activity` you started. Since `RecognizerIntent` doesn't specify the values for `requestCode`, they are likely implementation specific and not critical. – Larry Schiefer Feb 24 '14 at 11:32
  • You're welcolme. Is there a cleaner way to mark this question as duplicate ? – Pierre Rust Feb 24 '14 at 11:35
  • @PierreRust I have no idea. I marked it as duplicate. – Ari Feb 24 '14 at 11:35

0 Answers0