SpeechRecognizer should be used only from the application‘s main thread
·
1.U3d打包完成,遇到问题 。安卓的原生语音识别显示必须在主线程,待解决
SpeechRecognizer should be used only from the application’s main thread
参考https://developer.android.com/reference/android/os/Handler.
在onCreate中调用可以,通过u3d在外部调用 显示上面的错误
解决方案:
public void Speech()
{
Toast.makeText(MainActivity.this,"Speech",Toast.LENGTH_SHORT).show();
UnityPlayer.currentActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
doSpeechRecognition();
}
});
}
未完续待
后面会抽时间写一篇关于 安卓语音识别
更多推荐



所有评论(0)