1
SpeechRecognizer 클래스를 사용하고 있습니다.Android에서 SpeechRecognizer를 일시 중지했다가 다시 시작하는 방법은 무엇입니까?
SpeechRecognizer speechRecognizer;
speechRecognizer = SpeechRecognizer.createSpeechRecognizer(getBaseContext());
MyRecognitionListener speechListner=new MyRecognitionListener();
speechRecognizer.setRecognitionListener(speechListner);
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getApplication().getPackageName());
speechRecognizer.startListening(intent);
문제는 내가 일시 중지하고 재개 할 수 있다는 것입니다 :
여기 내 코드입니다. 이미 시도 :
speechRecognizer.cancel();
speechRecognizer.stopListening();
하지만 여전히 듣습니다.
취소하기 전에 stopListening()을 호출 해 보셨습니까? 취소 된 음성 인식기에 stopListening()을 호출 할 수 없습니다. – Erol
이 함수를 호출하는 곳도 중요합니다. RecognitionListener 클래스를 보는 것이 좋습니다. – Erol
@babatenor cancel() 전에 stopListening()을 호출하면 이제 작동합니다. 감사합니다. –