안드로이드 스튜디오 코틀린 질문이요!!
본문
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val i = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
i.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, packageName)
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "ko-KR")
val mRecognizer = SpeechRecognizer.createSpeechRecognizer(this)
mRecognizer.setRecognitionListener(listener)
mRecognizer.startListening(i)
} private val listener: RecognitionListener = object : RecognitionListener {
override fun onRmsChanged(rmsdb: Float) {
// TODO Auto-generated method stub
}
override fun onResults(results: Bundle) {
// TODO Auto-generated method stub
}
override fun onReadyForSpeech(params: Bundle) {
// TODO Auto-generated method stub
}
override fun onPartialResults(partialResults: Bundle) {
// TODO Auto-generated method stub
}
override fun onEvent(eventType: Int, params: Bundle) {
// TODO Auto-generated method stub
}
override fun onError(error: Int) {
// TODO Auto-generated method stub
}
override fun onEndOfSpeech() {
// TODO Auto-generated method stub
mRecognizer.startListening(i)
}
override fun onBufferReceived(buffer: ByteArray) {
// TODO Auto-generated method stub
}
override fun onBeginningOfSpeech() {
// TODO Auto-generated method stub
}
}
}
onEndOfSpeech()에서 다시 음성 녹음을 실행하는 mRecognizer.startListening(i) 실행시켜줄려면 어떻게 코드를 적어야되나요?
!-->
답변을 작성하시기 전에 로그인 해주세요.