Android SpeechRecognizer:stopListening()与cancel()

srf*_*srf 5 android speech-recognition voice-recognition

仅从名称,我可以推导出stopListening()与startListening()相反.

我也可以理解destroy()与createSpeechRecognizer()相反.

但取消() ......与什么相反?

我在文档中找到的所有内容是:

取消语音识别.

cancel()与stopListening()有何不同?

Ste*_*han 5

好吧,您取消 SpeechRecognition,即我认为没有结果返回给您,而在 stopListening() 上,您只需告诉识别器您已完成说话,它现在应该进行实际识别(并且可以关闭麦克风)。通常,您不需要自己调用 stopListening(),因为语音结束是自动确定的(自动终结点)。