android - Working with delay in Java -
i'm trying create speech recognition app app recieves voice , sends out stuff. i'd onendofspeech method called wait second , entire voice recognition intent start on again.
public void onendofspeech() { log.d("speech", "onendofspeech"); try { thread.sleep(3000); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); mspeechrecognizer.startlistening(mspeechrecognizerintent); }
not sure doing correctly. thanks!
this how should
try { thread.sleep(3000); mspeechrecognizer.startlistening(mspeechrecognizerintent); } catch (interruptedexception e) { // depends on app logic interruptedexception, can process or rethrow or restore interrupted flag }
Comments
Post a Comment