我为结果调用了新活动:
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
。