0

我使用意图语音识别,这里是代码:

/**
 * Fire an intent to start the voice recognition activity.
 */
private void startVoiceRecognitionActivity()
{
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice recognition Demo...");
    startActivityForResult(intent, REQUEST_CODE);
}

一切正常。例如,现在我想在 5 秒后停止语音识别。我不知道如何杀死语音识别活动。

4

1 回答 1

2

杀死你调用的语音识别活动finishActivity(REQUEST_CODE)。因此,您需要在call
中设置一个持续 5 秒的倒数计时器。通话后启动计时器onFinishfinishActivity(REQUEST_CODE)startActivityForResult

于 2013-05-13T09:50:17.090 回答