Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 隐藏点击说话界面谷歌语音api_Android_Speech Recognition_Google Speech Api - Fatal编程技术网

Android 隐藏点击说话界面谷歌语音api

Android 隐藏点击说话界面谷歌语音api,android,speech-recognition,google-speech-api,Android,Speech Recognition,Google Speech Api,我正在尝试开发一款使用语音命令访问主菜单的游戏。我想问一下如何从谷歌语音中隐藏点击通话界面?因为它几乎覆盖了我的所有屏幕。调用promptSpeechInput()启动语音识别活动。 使用onActivityResult()捕获结果 关于更具体的信息:我没有试图隐藏它,因为我是这个可能的副本的新手,我从您提供的同一个链接获得它。我的问题是,我想在按下麦克风图标后隐藏覆盖屏幕的点击通话界面。此答案显示界面/对话框@约瑟鲁迪要求把它藏起来。 /** * Showing google speech

我正在尝试开发一款使用语音命令访问主菜单的游戏。我想问一下如何从谷歌语音中隐藏点击通话界面?因为它几乎覆盖了我的所有屏幕。

调用promptSpeechInput()启动语音识别活动。 使用onActivityResult()捕获结果


关于更具体的信息:

我没有试图隐藏它,因为我是这个可能的副本的新手,我从您提供的同一个链接获得它。我的问题是,我想在按下麦克风图标后隐藏覆盖屏幕的点击通话界面。此答案显示界面/对话框@约瑟鲁迪要求把它藏起来。
/**
 * 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(getApplicationContext(),
                getString(R.string.speech_not_supported),
                Toast.LENGTH_SHORT).show();
    }
}

/**
 * Receiving speech input
 * */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

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

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

    }
}
 speechRecButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            promptSpeechInput();
        }
    });