活动结果的不同请求代码

时间:2014-02-24 11:18:44

标签: android android-intent android-activity

我为结果调用了新活动:

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);

SPEECH_RECOGNITION_REQUEST_CODE的定义方式如下:

public static final int SPEECH_RECOGNITION_REQUEST_CODE = 4;

但结果我得到了不同的价值:

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

我尝试使用SPEECH_RECOGNITION_REQUEST_CODE的不同值。

我正在使用android.support.v4

0 个答案:

没有答案