Android SpeechRecognizer should only be used from the application's main thread

牧云@^-^@ 提交于 2019-12-02 07:44:42

Call the SpeechClass on the main thread by doing something like this:

final SpeechClass c = getSpeechClass(); // get the speech class

View v = findViewById(R.id.anyview); //fetch a View: any one will do

v.post(new Runnable(){ public void run(){ c.doSomething(); }});

That should run it on the main thread. Might slow your UI down if doSomething takes a while, but you get to work that out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!