我已经尝试过这段代码,但是它没有工作,在收到错误8后,它没有再听,我该怎么办?
@Override
public void listen() {
myHandler.post(new Runnable() {
@Override
public void run() {
sr.startListening(i); // here i is Intent,SpeechRecognizer sr;
Log.d("message","start listening");
}
});
}
@Override
public void onError(int error) {
Log.d("message","error occurred! "+error);
if(error==8) {
sr.destroy();
myHandler.post(new Runnable() {
@Override
public void run() {
sr.startListening(i);
Log.d("message","again start listening");
}
});
}
}