public interface RecognitionListener
Modifier and Type | Method and Description |
---|---|
void |
onBeginningOfSpeech()
The user has started to speak.
|
void |
onBufferReceived(byte[] buffer)
More sound has been received.
|
void |
onEndOfSpeech()
Called after the user stops speaking.
|
void |
onError(int error)
A network or recognition error occurred.
|
void |
onEvent(int eventType,
Bundle params)
Reserved for adding future events.
|
void |
onPartialResults(Bundle partialResults)
Called when partial recognition results are available.
|
void |
onReadyForSpeech(Bundle params)
Called when the endpointer is ready for the user to start speaking.
|
void |
onResults(Bundle results)
Called when recognition results are ready.
|
void |
onRmsChanged(float rmsdB)
The sound level in the audio stream has changed.
|
void onReadyForSpeech(Bundle params)
params
- parameters set by the recognition service. Reserved for future use.void onBeginningOfSpeech()
void onRmsChanged(float rmsdB)
rmsdB
- the new RMS dB valuevoid onBufferReceived(byte[] buffer)
buffer
- a buffer containing a sequence of big-endian 16-bit integers representing a
single channel audio stream. The sample rate is implementation dependent.void onEndOfSpeech()
void onError(int error)
error
- code is defined in SpeechRecognizer
void onResults(Bundle results)
results
- the recognition results. To retrieve the results in ArrayList<String>
format use Bundle.getStringArrayList(String)
with
SpeechRecognizer.RESULTS_RECOGNITION
as a parameter. A float array of
confidence values might also be given in SpeechRecognizer.CONFIDENCE_SCORES
.void onPartialResults(Bundle partialResults)
onBeginningOfSpeech()
and onResults(Bundle)
when partial
results are ready. This method may be called zero, one or multiple times for each call to
SpeechRecognizer.startListening(Intent)
, depending on the speech recognition
service implementation. To request partial results, use
RecognizerIntent.EXTRA_PARTIAL_RESULTS
partialResults
- the returned results. To retrieve the results in
ArrayList<String> format use Bundle.getStringArrayList(String)
with
SpeechRecognizer.RESULTS_RECOGNITION
as a parametervoid onEvent(int eventType, Bundle params)
eventType
- the type of the occurred eventparams
- a Bundle containing the passed parameters