SpeechRecognitionListener启动,停止在单独的Thread上

时间:2013-08-27 22:50:16

标签: android speech-recognition

我已经创建了一个处理语音识别的服务。我创建了一个单独的线程(HandlerThread)来处理SpeechRecognitionioListener运行回调时的消息。我注意到,在onResult()收听后,我尝试在我的startListener中拨打Handler但应用崩溃,当我从startListener拨打Activity时{绑定} { {1}},一切正常,但我想从服务远程调用Service。是否有可能不从UI线程调用startListener

1 个答案:

答案 0 :(得分:0)

我相信你不能在服务中运行语音识别,它必须在主(UI)线程中运行。如果你检查错误日志,你应该能够确认这确实是显示停止。