Android 更新的表演活动,用于动作\u识别\u演讲

Android 更新的表演活动,用于动作\u识别\u演讲,android,speech,Android,Speech,我有以下代码: /** * Showing google speech input dialog */ private void promptSpeechInput() { Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent

我有以下代码:

/**
 * Showing google speech input dialog
 */
private void promptSpeechInput() {
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
            getString(R.string.speech_prompt));
    try {
        startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
    } catch (ActivityNotFoundException a) {
        Toast.makeText(getActivity().getApplicationContext(),
                getString(R.string.speech_not_supported),
                Toast.LENGTH_SHORT).show();
    }
我正在打电话:

button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            promptSpeechInput();
        }
    });
但我从未见过有录音的活动。立即有一个电话:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
        case REQ_CODE_SPEECH_INPUT: {
            if (resultCode == Activity.RESULT_OK && null != data) {

                ArrayList<String> result = data
                        .getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
                mAdapter.addTag(result.get(0));
                //txtSpeechInput.setText(result.get(0));
            }
            break;
        }

    }
}
@覆盖
ActivityResult上的公共void(int请求代码、int结果代码、意图数据){
super.onActivityResult(请求代码、结果代码、数据);
开关(请求代码){
案例请求代码语音输入:{
if(resultCode==Activity.RESULT\u OK&&null!=数据){
ArrayList结果=数据
.getStringArrayListExtra(识别器意图.额外结果);
mAdapter.addTag(result.get(0));
//txtSpeechInput.setText(result.get(0));
}
打破
}
}
}
使用resultCode==Activity.RESULT\u取消

我有上网的许可


谢谢。

祝酒词是否显示“演讲不受支持”?您是否有权限:?我发现问题,是活动中的android:launchMode=“singleInstance”:(